Skip to content

feat(providers): support SPIFFE-backed token grants#1784

Draft
TaylorMutch wants to merge 2 commits into
mainfrom
spiffe-token-provider-v2/tmutch
Draft

feat(providers): support SPIFFE-backed token grants#1784
TaylorMutch wants to merge 2 commits into
mainfrom
spiffe-token-provider-v2/tmutch

Conversation

@TaylorMutch
Copy link
Copy Markdown
Collaborator

Summary

Add SPIFFE-backed dynamic provider token grants so sandbox workloads can receive short-lived, endpoint-specific bearer tokens on demand.

This draft is intended for feedback. It incorporates and adapts the provider token grant material from #1781, then adds a runnable alpha/beta demo to validate the flow end to end.

Related Issue

Related/original material: #1781

Changes

  • Add provider profile token_grant metadata for SPIFFE JWT-SVID client assertion token exchange.
  • Expand provider profile credentials into endpoint-bound dynamic credentials with audience and scope overrides.
  • Add sandbox-side JWT-SVID fetching, token exchange, token caching, and L7 bearer-token injection for matching HTTP requests.
  • Add Kubernetes and Helm configuration for mounting the provider SPIFFE Workload API socket into sandbox pods.
  • Add Helm/SPIRE values, gateway config docs, architecture notes, and local development skill updates.
  • Add examples/spiffe-token-grant-demo, which deploys a mock token issuer plus alpha/beta protected services and validates endpoint-specific tokens.

Demo

The demo requires the Helm dev environment with SPIRE enabled.

Run the demo and delete the sandbox on exit:

KUBECONFIG=kubeconfig bash examples/spiffe-token-grant-demo/demo.sh

Run the demo and keep the sandbox for inspection:

KUBECONFIG=kubeconfig KEEP_SANDBOX=1 bash examples/spiffe-token-grant-demo/demo.sh

Expected output includes alpha receiving aud: alpha / scope: alpha profile email, beta receiving aud: beta / scope: beta profile email, and alpha/beta pod logs showing accepted requests with the sandbox SPIFFE ID.

Clean up the demo workloads:

KUBECONFIG=kubeconfig kubectl delete -k examples/spiffe-token-grant-demo/k8s

Testing

  • mise run pre-commit passes
  • cargo clippy -p openshell-sandbox --all-targets -- -D warnings passes
  • Manual demo: env KUBECONFIG=kubeconfig KEEP_SANDBOX=1 bash examples/spiffe-token-grant-demo/demo.sh
  • Manual verification that the agent process does not see SPIFFE/SVID/Workload API environment variables and cannot access the SPIFFE Workload API socket

Checklist

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

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Jun 5, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

Add provider profile token_grant metadata and expand endpoint-specific
dynamic credentials so sandbox supervisors can request SPIFFE JWT-SVIDs,
exchange them with an OAuth-style token endpoint, cache returned access
tokens, and inject bearer tokens into matching HTTP requests.

Wire Kubernetes and Helm deployments to mount the provider SPIFFE Workload
API socket into sandbox pods for token grant exchange.

Signed-off-by: Taylor Mutch <taylormutch@gmail.com>
Signed-off-by: Gordon Sim <gsim@redhat.com>
Add a reusable alpha/beta demo that deploys a SPIFFE-verifying token issuer
and protected services, imports a token-grant provider profile, creates a
sandbox, and verifies endpoint-specific bearer tokens.

The script leaves Kubernetes workloads in place, deletes sandboxes through
openshell unless KEEP_SANDBOX=1, and prints protected service logs as proof
of life.

Signed-off-by: Taylor Mutch <taylormutch@gmail.com>
@TaylorMutch TaylorMutch force-pushed the spiffe-token-provider-v2/tmutch branch from 003f466 to a552447 Compare June 5, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant