Skip to content

feat: Validate GAT ver claim supported version#228

Merged
minhtule merged 1 commit intomasterfrom
feat/validate-gat-ver-claim
Mar 17, 2026
Merged

feat: Validate GAT ver claim supported version#228
minhtule merged 1 commit intomasterfrom
feat/validate-gat-ver-claim

Conversation

@clement0010
Copy link
Copy Markdown
Contributor

@clement0010 clement0010 commented Mar 11, 2026

Changes

  • Validate that the GAT ver claim equals "1" in GATClaims.Validate(), returning jwt.ErrTokenInvalidClaims for unsupported versions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@clement0010 clement0010 requested a review from minhtule March 11, 2026 10:02
@clement0010 clement0010 changed the title feat: Validate GAT ver claim is supported version feat: Validate GAT ver claim supported version Mar 11, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.40%. Comparing base (81b7a3d) to head (62a4f71).
⚠️ Report is 4 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            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              
Flag Coverage Δ
integration 48.24% <0.00%> (+0.04%) ⬆️
unit 77.19% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
internal/token/gat_claims.go 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 supportedVersion constant and reject any ver claim not equal to "1" in GATClaims.Validate().
  • Introduce a dedicated errUnsupportedVersion sentinel error and wrap it under jwt.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.

Copy link
Copy Markdown
Contributor

@minhtule minhtule left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@minhtule minhtule merged commit 5ae05a1 into master Mar 17, 2026
18 checks passed
@minhtule minhtule deleted the feat/validate-gat-ver-claim branch March 17, 2026 10:36
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.

3 participants