feat(oidc): pin at+jwt audience on the Resource-Server verifier path #273
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/bunyip!273
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/BUNYIP-252-at-jwt-audience-binding"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
BUNYIP-252:
verify_at_jwt_claimsdeliberately setsvalidate_aud = falsebecause the OIDC userinfo endpoint MUST accept any at+jwt this OP issued (OIDC Core §5.3). The same verifier is also reused by theAtJwtVerifierimpl that protects bunyip-API's/v1/*routes, which makes every bunyip-API surface a confused deputy: a mokosh / drillmark / lets-chat at+jwt presented as a Bearer credential to/v1/membership,/v1/billing,/v1/admin/*is accepted as the token'ssub. RFC 9068 §4 explicitly says a Resource Server MUST refuse a token whoseauddoes not name it.Split the verifier:
verify_at_jwt_claimskeeps its permissive shape (userinfo's spec-mandated behaviour), and a newverify_at_jwt_for_rspinsvalidation.set_audience(&[OidcConfig::rs_audience]). TheAtJwtVerifier::verify_and_resolveimpl routes through the strict variant, so the/v1/*family now rejects RP-issued at+jwts.OidcConfig::rs_audiencedefaults tourn:bunyip:rsand is overridable viaOIDC_RS_AUDIENCE. Future Bearer-at+jwt callers register a client whose audience is the configured value and acquire tokens via the normal authorize/token dance; the current consumers of/v1/*(bunyip-web BFF via legacy HS256 cookie + the OIDC userinfo endpoint) are unaffected.The end-to-end mint/verify test belongs in a separate test-harness ticket: bunyip-oidc has no integration harness today and adding one is heavier than the audience-bind fix this ticket is about. The wiring is straightforward (one
set_audiencecall, called only from the RS path) and is exercised by every existing handler test that already touchesAtJwtVerifier.#BUNYIP-252