Skip to content

fix(jwt-bundle): honor jwt-svid use when loading authorities#418

Closed
maxlambrecht wants to merge 1 commit intospiffe:mainfrom
maxlambrecht:fix-jwtbundle-use-jwt-svid-only
Closed

fix(jwt-bundle): honor jwt-svid use when loading authorities#418
maxlambrecht wants to merge 1 commit intospiffe:mainfrom
maxlambrecht:fix-jwtbundle-use-jwt-svid-only

Conversation

@maxlambrecht
Copy link
Member

What

Enforce SPIFFE bundle semantics for JWT-SVID keys when loading JWT bundles. Only JWKs with use=jwt-svid are treated as JWT authorities, kid remains required for those JWT-SVID keys, and entries for other SVID types or unknown key types are ignored instead of being used as JWT authorities.

Why

Previously, JWT bundle ingestion accepted all EC/RSA JWKs regardless of the use parameter. This could cause incorrect behavior when consuming generic or mixed SPIFFE bundles, where keys for x509-svid or other usages might be present alongside JWT-SVID keys. The SPIFFE JWT-SVID and SPIFFE Bundle specifications require that JWT-SVID signing keys be selected via use=jwt-svid and that kid be present. Aligning the implementation with these semantics ensures only intended JWT-SVID keys are used for JWT validation and avoids treating other keys as JWT authorities.

How tested

Updated JwtBundleTest to:

  • Verify that a JWKS containing one jwt-svid key and one x509-svid key only loads the jwt-svid key as a JWT authority.
  • Confirm that JWT-SVID keys missing kid still fail with JwtBundleException
  • Ensure that non-JWT-SVID unknown-key-type entries are ignored.

Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
@maxlambrecht maxlambrecht requested a review from rturner3 as a code owner March 18, 2026 18:12
@maxlambrecht
Copy link
Member Author

Closing this PR. The use == "jwt-svid" filtering I added was based on SPIFFE trust bundle semantics, but this code only consumes JWT bundles from the Workload API, not raw SPIFFE trust bundles.

Per the Workload API spec, FetchJWTBundles already returns JWK Sets for JWT-SVID signing keys, so re-filtering by use in the client path is not appropriate here.

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