Skip to content

feat(providers): exchange the sandbox JWT-SVID at Google STS (GCP Workload Identity Federation) #5897

Description

@paezba

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:jwt

Acceptance Criteria

  • The exchange sends the SVID as subject_token and sends no client_assertion.
  • Invalid combinations are rejected when the profile is loaded.
  • An unmodified Google SDK using ADC completes a call from a sandbox.

Alternatives Considered

Agent Investigation

  • On main at c3f429b, oauth.rs:184 and oauth.rs:226 always send client_assertion, and subject_token.source only supports provider_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 as client_assertion.
  • The metadata emulator (provider_credentials.rs:705) only serves static GCP_*_ACCESS_TOKEN credentials.

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

  1. added
    state:acceptedA maintainer decided OpenShell should pursue this issue
    and removed
    state:triage-neededOpened without agent diagnostics and needs triage
    on Nov 23, 2026
  2. TaylorMutch commented on Nov 23, 2026

    @TaylorMutch
    Contributor

    I ran into this as well when testing on GKE. Welcome any PRs to address it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:acceptedA maintainer decided OpenShell should pursue this issue

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions