Skip to content

feat(providers): exchange the sandbox JWT-SVID as a token grant subject - #5937

Open
paezba wants to merge 1 commit into
ai-openshell:mainfrom
paezba:feat/5897-jwt-svid-token-grant-subject/paezba
Open

paezba wants to merge 1 commit into
ai-openshell:mainfrom
paezba:feat/5897-jwt-svid-token-grant-subject/paezba

Conversation

@paezba

@paezba paezba commented Nov 24, 2026 •

Copy link
Copy Markdown

Summary

Let a provider token grant send the sandbox JWT-SVID directly as the RFC 8693 subject_token, optionally without client authentication. This enables keyless Google Cloud access through Workload Identity Federation. A GCE metadata emulator placeholder lets unmodified Google SDKs using Application Default Credentials use the grant.

Related Issue

Closes #5897

Changes

  • Add subject_token.source: jwt_svid and a client_authentication object (mechanism: client_assertion | none, optional credential: {source: jwt_svid}) to token grants (ProviderCredentialTokenGrantClientAuthentication, field 11). Omitting it keeps today's client_assertion behavior.
  • Validate profiles at load time: none requires token_exchange with a jwt_svid subject and cannot be combined with client_assertion_type. A jwt_svid subject must not name a stored credential, and unknown sources or authentication values are rejected.
  • Supervisor: dedicated supervisors exchange the JWT-SVID (requested with jwt_svid_audience) at token_endpoint without a gateway call. They send no client_assertion when client_authentication.mechanism: none.
  • Gateway: shared-supervisor token grants support the same flow with the stable sandbox JWT-SVID. Previously the gateway refused them with FailedPrecondition. Grant-flow resolution moved to openshell-core::oauth::TokenGrantFlow so the supervisor and gateway share it.
  • Add gce_metadata_token (field 13): the sandbox GCE metadata emulator serves a non-secret placeholder access token for the credential. The token grant replaces it on the credential's endpoints; requests elsewhere that carry the placeholder are refused.
  • Docs: docs/how-it-works/providers/profiles.mdx, the openshell-server and openshell-supervisor-network READMEs, and examples/spiffe-gcp-sts-demo.
  • Update the storage schema fingerprints in storage_proto.rs for the new proto fields.

Release Notes

Provider token grants can exchange the sandbox SPIFFE JWT-SVID directly at an STS such as Google's (subject_token.source: jwt_svid, client_authentication.mechanism: none). With gce_metadata_token: true, Google SDKs using Application Default Credentials reach Google Cloud APIs from a sandbox without a stored key.

Testing

  • Checks appropriate to the affected code and behavior pass

  • Unit tests added/updated (if applicable)

  • E2E tests added/updated (if applicable)

  • cargo fmt --check and cargo clippy -D warnings on openshell-core, openshell-providers, openshell-server, and openshell-supervisor-network

  • cargo test -p openshell-core -p openshell-providers

  • cargo test -p openshell-server --tests --bins

  • cargo test -p openshell-supervisor-network --lib: the token grant tests pass. 8 proxy::tests failures on macOS also fail on main unchanged.

  • mise run markdown:lint, proto:lint, buf breaking against main, license:check, docs:nav, docs:build:strict

  • Not run: a live Google STS / SPIRE end-to-end call with an unmodified Google SDK. A local run of e2e:kubernetes:shared-supervisor-spiffe on Colima couldn't reach the host-side test fixtures, so it didn't get as far as token grants.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Nov 24, 2026
@paezba
paezba force-pushed the feat/5897-jwt-svid-token-grant-subject/paezba branch from 971313b to 1b83bbf Compare November 25, 2026 08:37
@grs

grs commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

This adds a useful flow. To leave room for further configurability in future PRs, could we make client_authentication an object that separates the authentication mechanism from the credential used for it? For example:

client_authentication:
  mechanism: client_assertion
  credential:
    source: jwt_svid

There are independent choices here: the grant type, the subject credential, the client authentication mechanism, and the credential used to authenticate. The scalar client_assertion implicitly couples the last two to the sandbox JWT-SVID. An object would leave room for other credential sources and mechanism-specific settings without restructuring the config later.

We only need to support the combinations implemented here initially, including mechanism: none, and preserve existing behavior when omitted. Just keen to leave these choices independently expressible as token grants evolve.

@paezba
paezba force-pushed the feat/5897-jwt-svid-token-grant-subject/paezba branch from 1b83bbf to f1acec3 Compare November 25, 2026 15:35
@paezba

paezba commented Nov 25, 2026 •

Copy link
Copy Markdown
Author

This adds a useful flow. To leave room for further configurability in future PRs, could we make client_authentication an object that separates the authentication mechanism from the credential used for it? For example:

client_authentication:
  mechanism: client_assertion
  credential:
    source: jwt_svid

There are independent choices here: the grant type, the subject credential, the client authentication mechanism, and the credential used to authenticate. The scalar client_assertion implicitly couples the last two to the sandbox JWT-SVID. An object would leave room for other credential sources and mechanism-specific settings without restructuring the config later.

We only need to support the combinations implemented here initially, including mechanism: none, and preserve existing behavior when omitted. Just keen to leave these choices independently expressible as token grants evolve.

Thanks @grs. client_authentication is now an object, {mechanism: client_assertion | none, credential: {source: jwt_svid}}. Omitting it keeps the current client_assertion behavior. Only the combinations that are implemented are accepted.

@grs

grs commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Thanks @paezba! One minor suggestion inline, but looks good to me!

@paezba

paezba commented Nov 25, 2026

Copy link
Copy Markdown
Author

Thanks @paezba! One minor suggestion inline, but looks good to me!

Thanks @grs. I don't see the inline suggestion on my side. Could it still be pending in your review?

@grs

grs commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Thanks @paezba! One minor suggestion inline, but looks good to me!

Thanks @grs. I don't see the inline suggestion on my side. Could it still be pending in your review?

Got an unnoticed error on submitting the comment.

Minor nit: it would perhaps be better to reject unknown mechanisms on importing a profile as otherwise a typo leads to an unexpected mechanism. (token_grant_client_authentication_from_proto currently maps them to Unspecified so runtime rejection won't cath it)

@paezba
paezba force-pushed the feat/5897-jwt-svid-token-grant-subject/paezba branch 2 times, most recently from eaceecb to 79a1025 Compare November 26, 2026 10:53
Add subject_token.source jwt_svid and client_authentication
(client_assertion | none) to provider token grants so the sandbox
JWT-SVID can be sent directly as the RFC 8693 subject_token, for
example to Google STS for Workload Identity Federation. Invalid
combinations are rejected at profile load.

Dedicated supervisors perform the exchange without a gateway call;
gateway-brokered grants for shared supervisors use the stable sandbox
JWT-SVID. Grant flow resolution is shared in openshell-core.

Add gce_metadata_token so the sandbox GCE metadata emulator serves a
placeholder access token that the token grant replaces, letting
unmodified Google SDKs using Application Default Credentials work.

Closes ai-openshell#5897

Signed-off-by: paezba <64277512+paezba@users.noreply.github.com>
@paezba
paezba force-pushed the feat/5897-jwt-svid-token-grant-subject/paezba branch from 79a1025 to da267db Compare November 27, 2026 15:52

This branch has not been deployed

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

Labels

state:accepted A maintainer decided OpenShell should pursue this issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants