Repository navigation
Name the ID-JAG JWT type once - #7070
Conversation
The ID-JAG typ value was spelled as a string literal in several places, and the vMCP XAA strategy kept its own private copy. A later change checks this value at access-token and subject-token validators, so it needs one shared definition. The constant moves to oauthproto next to the ID-JAG token type URN, and both the auth server and vMCP use it. The tokenexchange package comment moves to doc.go and now says what the package holds: the RFC 8693 handlers, the RFC 7523 redemption handlers and the trust layer they share. Ref: #6898 Co-authored-by: Mecatl <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7070 +/- ##
==========================================
- Coverage 80.90% 80.85% -0.06%
==========================================
Files 864 864
Lines 88634 88633 -1
==========================================
- Hits 71709 71660 -49
- Misses 16920 16968 +48
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rdimitrov
left a comment
There was a problem hiding this comment.
Approving: a behaviour-neutral consolidation of the ID-JAG typ value into one shared constant.
Design: pkg/oauthproto already owns the protocol constants shared by the authserver and vMCP, so JWTTypeIDJAG belongs next to TokenTypeIDJAG. Every Go comparison site now uses it (JWT-bearer and ID-JAG handler routing, CanSkipClientAuth, the assertion-type allowlist, and the vMCP XAA check), and no code literal remains. The value is byte-identical and the comparisons keep their semantics (exact match on the server, EqualFold in vMCP), so upgrades see no change. The old constant was unexported, so nothing public is removed.
Note for the follow-up that will refuse this typ in the access-token/subject-token validators: the server compares typ by exact match, while xaa.go ignores case. typ is a media type, so it compares case-insensitively and may carry an application/ prefix. An exact-match refusal list could be bypassed with OAuth-ID-JAG+JWT or application/oauth-id-jag+jwt. A small normalising helper next to this constant in oauthproto (lowercase, strip application/) would close that before it matters. The current allowlist fails closed, so this PR is not affected.
🤖 Reviewed with Claude Code
Summary
ID-JAG issuance through token exchange (#6898) needs the ID-JAG JOSE
typvalue,oauth-id-jag+jwt, in more places. The next change refuses thattypat the access-token and subject-token validators. Today the value is a private constant injwt_bearer_handler.go, a second private constant in the vMCP XAA strategy, and string literals in tests. This PR defines it once before more code depends on it.oauthproto.JWTTypeIDJAGnext to the existingoauthproto.TokenTypeIDJAGURN.typcheck, and in the tests that sign ID-JAG assertions.tokenexchangepackage comment fromvalidator.goto a newdoc.go, and rewrite it to list what the package now holds: the RFC 8693 handlers, the RFC 7523 JWT-bearer and ID-JAG redemption handlers, and the trust layer they share.Ref #6898
Type of change
Test plan
task test)task lint: 0 issues)Changes
pkg/oauthproto/constants.goJWTTypeIDJAGconstantpkg/authserver/server/tokenexchange/jwt_bearer_handler.go,id_jag_handler.goidJAGJWTType; use the shared constantpkg/vmcp/auth/strategies/xaa.gopkg/authserver/server/tokenexchange/doc.go,validator.go*_test.go(7 files)Does this introduce a user-facing change?
No. The value is the same, and every comparison that uses it is unchanged.