Skip to content

feat(oidc-provider): accept a per-bucket audience via oidc_audience - #167

Open
alukach wants to merge 1 commit into
mainfrom
feat/oidc-audience-option
Open

alukach wants to merge 1 commit into
mainfrom
feat/oidc-audience-option

Conversation

@alukach

@alukach alukach commented Nov 8, 2026

Copy link
Copy Markdown
Member

AwsBackendAuth reads an optional oidc_audience backend option and mints the web-identity JWT with that aud instead of the provider-wide audience given to OidcCredentialProvider::new. The option is stripped from the resolved backend options, as oidc_subject already is. Buckets that don't set it behave exactly as before.

The new OidcCredentialProvider::get_credentials_with_audience does the work; get_credentials keeps its signature and passes the default audience, so existing callers are unaffected.

The credential cache key now includes the audience alongside the subject. AWS checks aud against the client IDs registered on the IAM OIDC provider before it evaluates the role's trust policy, so two exchanges that differ only in audience are not interchangeable, and a credential minted under one must not be served for the other. Keying on the audience outright is simpler than relying on it being derivable from the subject.

This lets a gateway give each backend its own audience, so a role owner can register exactly that audience on their OIDC provider and have STS reject tokens minted for any other backend before policy evaluation, rather than depending on a sub condition in the trust policy.

Testing

  • cargo test -p multistore-oidc-provider: 42 passed, including two new tests: oidc_audience_sets_aud_and_is_stripped (decodes the WebIdentityToken sent to STS and checks aud, with and without the option) and audiences_do_not_share_cached_credentials (same role and subject, a second audience triggers a second STS exchange).
  • cargo clippy -p multistore-oidc-provider --all-targets -- -D warnings: clean.

🤖 Generated with Claude Code

`AwsBackendAuth` reads an optional `oidc_audience` backend option and mints the web-identity JWT with that `aud` instead of the provider-wide default, then strips the option like `oidc_subject`. `OidcCredentialProvider::get_credentials_with_audience` is the underlying call; `get_credentials` keeps its signature and uses the default.

The credential cache key now includes the audience as well as the subject. A cloud checks `aud` against the client IDs registered for the issuer before evaluating any trust policy, so a credential minted under one audience must not be served for an exchange under another.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XR9ZJnpPSJFK6LFSBxePNE
@claude

claude Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Claude finished @alukach's task in 11s —— View job


I'll analyze this and get back to you.


💰 Estimated review cost: $0.14 · 0m10s · 3 turns

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

🚀 Latest commit deployed to https://multistore-proxy-pr-167.development-seed.workers.dev

  • Date: 2026-11-08T23:27:27Z
  • Commit: 62bebfb

This branch was successfully deployed

1 active deployment
preview — 59196c17 Deployed Nov 8, 2026 by alukach via Deploy & Test / Deploy #486
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant