Restrict Google JSON credentials to the service_account
type.
#16003
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because of golang/oauth2#583, it's possible to get a panic when trying to use a Google Developers Console
client_credentials.json
(like the one that gets helpfully suggested for download when creating a OAuth client ID, like what happened in #15608).Going through the code of
golang.org/x/oauth2/google.CredentialsFromJSONWithParams
I realized that we have also allowed other credential types that don't support domain-wide delegation at all (theparams.Subject
parameter is completely ignored) and would thus lead to a broken setup anyway, so if we restrict ourselves to just theservice_account
type we will work around the panic bug while giving out an understandablegoogle: read JWT from JSON credentials: 'type' field is "other_type" (expected "service_account")
error in the auth logs.