Skip to content

Commit

Permalink
fix(auth): Enable client certificates by default only for GDU (#10151)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyrzhao authored May 10, 2024
1 parent bcb5568 commit 7c52978
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions auth/internal/transport/cba.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func getTransportConfig(opts *Options) (*transportConfig, error) {
// encountered while initializing the default source will be reported as client
// error (ex. corrupt metadata file).
func getClientCertificateSource(opts *Options) (cert.Provider, error) {
if !isClientCertificateEnabled() {
if !isClientCertificateEnabled(opts) {
return nil, nil
} else if opts.ClientCertProvider != nil {
return opts.ClientCertProvider, nil
Expand All @@ -226,14 +226,14 @@ func getClientCertificateSource(opts *Options) (cert.Provider, error) {

}

// isClientCertificateEnabled returns true by default, unless explicitly set to false via env var.
func isClientCertificateEnabled() bool {
// isClientCertificateEnabled returns true by default for all GDU universe domain, unless explicitly overridden by env var
func isClientCertificateEnabled(opts *Options) bool {
if value, ok := os.LookupEnv(googleAPIUseCertSource); ok {
// error as false is OK
b, _ := strconv.ParseBool(value)
return b
}
return true
return opts.isUniverseDomainGDU()
}

type transportConfig struct {
Expand Down

0 comments on commit 7c52978

Please sign in to comment.