feat: Validate GAT ver claim supported version#228
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ver claim supported version
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #228 +/- ##
==========================================
+ Coverage 82.39% 82.40% +0.01%
==========================================
Files 35 35
Lines 2590 2592 +2
==========================================
+ Hits 2134 2136 +2
Misses 346 346
Partials 110 110
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enforces a single supported version for GAT tokens by validating that the ver claim equals "1" during GATClaims.Validate(), and ensures unsupported versions surface as jwt.ErrTokenInvalidClaims.
Changes:
- Add a
supportedVersionconstant and reject anyverclaim not equal to"1"inGATClaims.Validate(). - Introduce a dedicated
errUnsupportedVersionsentinel error and wrap it underjwt.ErrTokenInvalidClaims. - Add a unit test covering the unsupported-version validation path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/token/gat_claims.go | Adds explicit ver-value validation against a supported version and returns jwt.ErrTokenInvalidClaims for unsupported versions. |
| internal/token/gat_claims_test.go | Adds a test case asserting unsupported ver values are rejected with the expected JWT error and message substring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Changes
verclaim equals"1"inGATClaims.Validate(), returningjwt.ErrTokenInvalidClaimsfor unsupported versions