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(internal): don't self-sign JWT when an endpoint provided #847

Merged
merged 1 commit into from Jan 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions internal/creds.go
Expand Up @@ -65,8 +65,9 @@ const (
// credentialsFromJSON returns a google.Credentials based on the input.
//
// - A self-signed JWT auth flow will be executed if: the data file is a service
// account, no user are scopes provided, an audience is provided, and
// credentials will not be impersonated.
// account, no user are scopes provided, an audience is provided, a user
// specified endpoint is not provided, and credentials will not be
// impersonated.
//
// - Otherwise, executes a stanard OAuth 2.0 flow.
func credentialsFromJSON(ctx context.Context, data []byte, ds *DialSettings) (*google.Credentials, error) {
Expand All @@ -78,7 +79,8 @@ func credentialsFromJSON(ctx context.Context, data []byte, ds *DialSettings) (*g
if len(data) == 0 ||
len(ds.Scopes) > 0 ||
(ds.DefaultAudience == "" && len(ds.Audiences) == 0) ||
ds.ImpersonationConfig != nil {
ds.ImpersonationConfig != nil ||
ds.Endpoint != "" {
return cred, nil
}

Expand Down