Skip to content

fix: set JWK use=jwt-svid in JWKS (JWT-SVID §4)#101

Open
safayavatsal wants to merge 4 commits intohighflame-ai:mainfrom
safayavatsal:fix/jwt-svid-jwks-use-43
Open

fix: set JWK use=jwt-svid in JWKS (JWT-SVID §4)#101
safayavatsal wants to merge 4 commits intohighflame-ai:mainfrom
safayavatsal:fix/jwt-svid-jwks-use-43

Conversation

@safayavatsal
Copy link
Copy Markdown
Contributor

@safayavatsal safayavatsal commented Apr 28, 2026

Summary

  • Publish use=jwt-svid on every JWK at /.well-known/jwks.json per JWT-SVID §4.
  • Initial attempt flipped use in addToKeySet directly. That broke our own introspection path: lestrrat-go/jwx's verifier (jws/key_provider.go:113) skips keys whose use is anything other than "sig", so the in-memory keyset stopped verifying signatures.
  • Split the concern: keep use=sig in the in-memory keyset (jwx-based verifiers, including our /oauth2/token/introspect, keep working) and rewrite use to "jwt-svid" at the JWKS handler boundary only.
  • Normalize use=jwt-svid → sig on ingest in pkg/authjwt's JWKS refresh so authjwt-based consumers keep working against the new bundle.
  • Updates the regression assertion in tests/integration/wellknown_test.go.

Fixes #43

Test plan

  • go vet ./... clean
  • go build ./... clean
  • make test passes (TestJWKSEndpoint asserts use=jwt-svid; TestAuthjwtVerifiesZeroIDToken and TestAuthjwtAcceptsDefaultedAudience confirm authjwt still works against the new bundle)
  • Manual: curl http://localhost:8899/.well-known/jwks.json | jq '.keys[].use' returns "jwt-svid" for both keys

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
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
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.

JWT-SVID: JWKS use parameter is "sig" instead of "jwt-svid"

2 participants