Repository navigation
Description
User Story
I use OpenShell on GKE with SPIRE to run AI agents in sandboxes. Each agent needs to call Google Cloud APIs as its own SPIFFE identity, and the workload must never hold a Google token. Today agents can't do that.
Problem Statement
OpenShell can't exchange a sandbox's JWT-SVID at Google STS. STS only does RFC 8693 token exchange, expects the JWT as subject_token, and doesn't use client authentication. OpenShell's token grants always send the SVID as client_assertion. #1665 was closed on the assumption that GCP accepts it that way, and it doesn't.
Impact / Why This Matters
Without this, operators have to mint Google tokens and push them into sandboxes as static credentials. That needs a privileged component with access to every agent, and each refresh resets connections (#4945). GKE Workload Identity can't tell sandboxes apart either, because they all share one Kubernetes service account. So in GCP IAM and audit logs, every agent looks like the same caller.
Proposed Design
In a provider profile, a token exchange can use the sandbox's own SVID as the subject, with no client authentication. Google SDKs that look up credentials automatically (ADC) get a placeholder from the metadata emulator, and the real token is injected on requests to *.googleapis.com.
token_grant:
grant_type: token_exchange
token_endpoint: https://sts.googleapis.com/v1/token
audience: //iam.googleapis.com/projects/<N>/locations/global/workloadIdentityPools/<pool>/providers/<provider>
client_authentication: none
subject_token:
source: jwt_svid
subject_token_type: urn:ietf:params:oauth:token-type:jwtAcceptance Criteria
- The exchange sends the SVID as
subject_tokenand sends noclient_assertion. - Invalid combinations are rejected when the profile is loaded.
- An unmodified Google SDK using ADC completes a call from a sandbox.
Alternatives Considered
- Static GCP token pushed by an operator. It needs a component that mints tokens for every agent, and each refresh resets connections (bug(supervisor): routine provider token refresh bumps the policy generation and closes in-flight tunnels and streams #4945).
- External SVID-to-STS proxy (e.g. spiffe-gcp-proxy). It duplicates OpenShell's token cache, injection and failure reporting, and the proxy would need SVIDs for every sandbox.
- Existing
token_exchangewith a stored subject credential. Someone still has to mint and store a token, which is the problem this request solves.
Agent Investigation
- On
mainatc3f429b,oauth.rs:184andoauth.rs:226always sendclient_assertion, andsubject_token.sourceonly supportsprovider_credential(openshell.proto:2510). - Both the supervisor path (
token_grant.rs:224) and the gateway path from feat(gateway): broker stable sandbox SPIFFE provider tokens #4732 (access_token.rs:409) use the SVID only asclient_assertion. - The metadata emulator (
provider_credentials.rs:705) only serves staticGCP_*_ACCESS_TOKENcredentials.
Related: #1665, #4732, #3860, #5473
Checklist
- I've reviewed existing issues and the published docs
- This is a design proposal, not a "please build this" request
Activity
TaylorMutch commentedon Nov 23, 2026
I ran into this as well when testing on GKE. Welcome any PRs to address it!