Skip to content
Permalink
Browse files

fix(transport): expand OS environment variables in cert provider comm…

…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 committed Feb 1, 2021
1 parent c54d9d7 commit be6c56a1948a57eb0300613a70ef608330ca36e0
Showing with 4 additions and 0 deletions.
  1. +4 −0 transport/cert/default_cert.go
@@ -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 {

0 comments on commit be6c56a

Please sign in to comment.