feat(google): accept pre-minted access tokens for service-account impersonation / OIDC#2191
Open
jorgegmz wants to merge 1 commit into
Open
Conversation
…ersonation / OIDC
Author
|
Hi @alphadev4, Friendly ping for review when time permits. This PR adds support for GCP service-account impersonation, workload identity federation, and OIDC-based authentication by allowing callers to provide a pre-minted Google Cloud access token instead of a service-account private key. The change is fully backward compatible with the existing authentication paths and requires no plugin changes. I'd appreciate any feedback when you have a chance. Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a pre-minted access-token path to the GCP authentication flow so callers that already hold a valid Google Cloud OAuth2 access token can bypass the JWT-from-private-key exchange and inject the token directly.
Mirrors the existing pattern added for Azure in # (
feat(azure): accept pre-minted access tokens for federated identity / OIDC).Why
There are several legitimate scenarios where a caller has a valid Google Cloud access token but no service-account JSON key:
iamcredentials.generateAccessToken— the orchestrator holds an executor SA and mints short-lived tokens against target SAs.Today these callers must either embed a long-lived private key (defeating the purpose of impersonation/federation) or fork/vendor patches against CloudSploit.
What changed
helpers/google/index.jsauthenticate(): whenGoogleConfig.access_tokenis present, return anOAuth2Clientwith the token set directly viasetCredentials({ access_token }). The returned client exposes the same.request()surface that plugins consume — no plugin changes required.index.js: newelse ifbranch detectingconfig.credentials.google.access_tokenand configuringcloudConfigwith{ type, project, access_token }. Placed ahead of the existingclient_email + private_keybranch so thepre-minted path takes precedence when a token is supplied.
projectis still required so plugins can address the correct GCP project.Test plan
client_email + private_key) continues to work unchanged.access_tokenpath authenticates plugin API calls successfully.projectproduces a clear "missing required key" error.credential_filepath remains unaffected (it's still evaluated first).