feat/google-service-account - #416
Open
yosukekmt wants to merge 1 commit into
Open
Conversation
yosukekmt
force-pushed
the
feat/google-service-account
branch
from
July 7, 2026 16:40
2383b16 to
acf1ac1
Compare
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.
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
Feature — adds a new
google_service_accountsecret type.What is the current behavior?
Closes #414
There is currently no way to authenticate agent requests to general Google APIs (Drive, Sheets, Storage, ...) as a GCP service account. The existing options don't cover this:
cloud-platformscope and*-aiplatform.googleapis.comhosts.Storing an SA key as a
genericsecret doesn't work either, since the JSON key is not itself a Bearer credential — it must be exchanged (signed JWT → access token) before injection.What is the new behavior?
Users can register a Google Service Account JSON key as a secret. The gateway signs a short-lived RS256 JWT, exchanges it at
oauth2.googleapis.com/token, caches the resulting access token in memory, and injects it as a Bearer header into matching requests. The private key never leaves the vault — agents only ever see request results. Details, following the pattern of existing code paths:(
type: "service_account",private_key,client_email), metadata extraction limited toclient_email/project_id, default hostPatternwww.googleapis.com.build_injections()synchronous. JWT claims omitsub(only meaningful for domain-wide delegation; causesinvalid_grantwithout it). In-memory cache with ~50 min TTL and a 10 min safety margin, keyed bysecret_id+ a hash of the secret value so key rotation invalidates immediately. Injection is explicitly skipped foroauth2.googleapis.comto prevent circular injection if a user broadens the host pattern.client_email/project_id. Secret cards show the client email. Scope is hardcoded todrive.readonlyfor the MVP and stated in the dialog; configurable scopes are planned as a follow-up.Additional context
mode="mitm", token exchange logged once, then cache hits).refresh_via_service_account()withscope/subparameterized — kept out of this PR to minimize blast radius, per maintainer preference. Follow-ups (out of scope): configurable scopes via secret metadata, credential-stub interception for Google SDKs (as Vertex AI does).