Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(auth): fallback cert lookups for missing files #11013

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions auth/internal/transport/cert/enterprise_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package cert

import (
"crypto/tls"
"errors"

"github.com/googleapis/enterprise-certificate-proxy/client"
)
Expand All @@ -37,10 +36,9 @@ type ecpSource struct {
func NewEnterpriseCertificateProxyProvider(configFilePath string) (Provider, error) {
key, err := client.Cred(configFilePath)
if err != nil {
if errors.Is(err, client.ErrCredUnavailable) {
return nil, errSourceUnavailable
}
return nil, err
// TODO(codyoss): once this is fixed upstream can handle this error a
// little better here. But be safe for now and assume unavailable.
return nil, errSourceUnavailable
}

return (&ecpSource{
Expand Down
5 changes: 1 addition & 4 deletions auth/internal/transport/cert/workload_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ func (s *workloadSource) getClientCertificate(info *tls.CertificateRequestInfo)
func getCertAndKeyFiles(configFilePath string) (string, string, error) {
jsonFile, err := os.Open(configFilePath)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return "", "", errSourceUnavailable
}
return "", "", err
return "", "", errSourceUnavailable
}

byteValue, err := io.ReadAll(jsonFile)
Expand Down
Loading