Skip to content

Commit

Permalink
fix(transport): expand OS environment variables in cert provider comm…
Browse files Browse the repository at this point in the history
…and (#852)

Environment variables in the cert provider command such as "$HOME" needs to be expanded. This logic was accidentally removed in an earlier patch, so it is being added back now. It impacts scenarios using customized context_aware_metadata.json.
  • Loading branch information
andyrzhao authored Feb 1, 2021
1 parent c54d9d7 commit be6c56a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions transport/cert/default_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func (s *secureConnectSource) getClientCertificate(info *tls.CertificateRequestI
if defaultCert.cachedCert != nil && !isCertificateExpired(defaultCert.cachedCert) {
return defaultCert.cachedCert, nil
}
// Expand OS environment variables in the cert provider command such as "$HOME".
for i := 0; i < len(s.metadata.Cmd); i++ {
s.metadata.Cmd[i] = os.ExpandEnv(s.metadata.Cmd[i])
}
command := s.metadata.Cmd
data, err := exec.Command(command[0], command[1:]...).Output()
if err != nil {
Expand Down

0 comments on commit be6c56a

Please sign in to comment.