fix: set JWK use=jwt-svid in JWKS (JWT-SVID §4)#101
Open
safayavatsal wants to merge 4 commits intohighflame-ai:mainfrom
Open
fix: set JWK use=jwt-svid in JWKS (JWT-SVID §4)#101safayavatsal wants to merge 4 commits intohighflame-ai:mainfrom
safayavatsal wants to merge 4 commits intohighflame-ai:mainfrom
Conversation
Conformant SPIFFE verifiers reject bundles where the published JWKs don't carry use=jwt-svid. We were emitting use=sig (RFC 7517 generic), which broke JWT-SVID interop with any standard SPIFFE workload client. Updates the regression assertion in wellknown_test.go to match. Fixes highflame-ai#43
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the JWKS key usage from "sig" to "jwt-svid" in internal/signing/jwks.go to comply with JWT-SVID §4 and SPIFFE verifier requirements. Corresponding integration tests in tests/integration/wellknown_test.go have been updated to reflect this change. I have no feedback to provide.
The first attempt (flipping use= directly in addToKeySet) broke our own introspection path: lestrrat-go/jwx's verifier filters out any key whose use is set to anything other than "sig" (jws/key_provider.go:113), so the in-memory keyset became unusable for signature verification. Split the concern: keep use=sig in the in-memory keyset (so jwx-based verifiers, including our internal introspection, still work) and rewrite use to "jwt-svid" only at the JWKS handler boundary. The published bundle is now spec-compliant for SPIFFE clients. Also normalize use=jwt-svid → sig on ingest in pkg/authjwt's JWKS refresh, so authjwt-based consumers keep working against the new bundle. Fixes highflame-ai#43
rsharath
approved these changes
May 5, 2026
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
use=jwt-svidon every JWK at/.well-known/jwks.jsonper JWT-SVID §4.useinaddToKeySetdirectly. That broke our own introspection path:lestrrat-go/jwx's verifier (jws/key_provider.go:113) skips keys whoseuseis anything other than"sig", so the in-memory keyset stopped verifying signatures.use=sigin the in-memory keyset (jwx-based verifiers, including our/oauth2/token/introspect, keep working) and rewriteuseto"jwt-svid"at the JWKS handler boundary only.use=jwt-svid → sigon ingest inpkg/authjwt's JWKS refresh so authjwt-based consumers keep working against the new bundle.tests/integration/wellknown_test.go.Fixes #43
Test plan
go vet ./...cleango build ./...cleanmake testpasses (TestJWKSEndpointassertsuse=jwt-svid;TestAuthjwtVerifiesZeroIDTokenandTestAuthjwtAcceptsDefaultedAudienceconfirm authjwt still works against the new bundle)curl http://localhost:8899/.well-known/jwks.json | jq '.keys[].use'returns"jwt-svid"for both keys