📝 Description
JWTs containing extremely large exp (Expiration Time) values currently trigger inconsistent behavior during claims validation. Depending on the platform and how the numeric value is parsed (e.g., as a float64 from JSON or cast to an integer), the parser may overflow, wrap around, or treat the token as effectively non-expiring.
To ensure consistent and secure validation, the parser must reject expiration timestamps (and other time-based claims like nbf and iat) that cannot be safely represented as a valid Go time.Time object or that exceed reasonable temporal boundaries.
🎯 Acceptance Criteria
🛠️ Technical Specifications & Context
In Go, JSON numbers are typically parsed as float64 or json.Number. When converting these values to Unix timestamps using time.Unix(), extremely large values can lead to unexpected times due to integer overflow or floating-point truncation.
Potential Areas of Modification:
claims.go / validation.go: Locate the validation logic where exp, nbf, and iat claims are extracted and verified.
- Helper Functions: Implement a helper function to verify if a numeric claim (either
float64 or json.Number) falls within a safe Unix timestamp range before passing it to time.Unix().
- Safe Range Example: Unix time values should generally be between
0 (or a reasonable minimum like -62135596800 for Year 1) and 253402300799 (December 31, 9999 23:59:59 UTC) to prevent formatting and database compatibility issues, or at least bounded to prevent Go's internal time.Time representation from overflowing during comparisons (e.g., time.Now().After(exp)).
// Example check
const MaxUnixTime = 253402300799 // Year 9999
func isValidTimestamp(val float64) bool {
return val >= 0 && val <= MaxUnixTime
}
🧪 Verification & Testing
To verify the fix, add unit tests in the test suite (e.g., claims_test.go or validation_test.go):
-
Test Case: Maximum Integer Overflow
- Attempt to parse/validate a token with
exp set to 9223372036854775807.
- Expected Result: Validation fails with an out-of-bounds or malformed claim error.
-
Test Case: Large Floating Point
- Attempt to parse/validate a token with
exp set to 1e21.
- Expected Result: Validation fails.
-
Test Case: Valid Large Expiration
- Attempt to parse/validate a token with a valid future date (e.g., year 2050 /
2524608000).
- Expected Result: Validation succeeds (assuming the token is not expired relative to the current time).

This repo is using Opire - what does it mean? 👇
💵 Everyone can add rewards for this issue commenting /reward 100 (replace 100 with the amount).
🕵️♂️ If someone starts working on this issue to earn the rewards, they can comment /try to let everyone know!
🙌 And when they open the PR, they can comment /claim #1 either in the PR description or in a PR's comment.
🪙 Also, everyone can tip any user commenting /tip 20 @heathivorjocelyn6 (replace 20 with the amount, and @heathivorjocelyn6 with the user to tip).
📖 If you want to learn more, check out our documentation.
📝 Description
JWTs containing extremely large
exp(Expiration Time) values currently trigger inconsistent behavior during claims validation. Depending on the platform and how the numeric value is parsed (e.g., as afloat64from JSON or cast to an integer), the parser may overflow, wrap around, or treat the token as effectively non-expiring.To ensure consistent and secure validation, the parser must reject expiration timestamps (and other time-based claims like
nbfandiat) that cannot be safely represented as a valid Gotime.Timeobject or that exceed reasonable temporal boundaries.🎯 Acceptance Criteria
exp(Expiration Time),nbf(Not Before), andiat(Issued At) claims contain numeric values that can be safely converted to a Gotime.Timewithout integer overflow or precision loss that alters validation logic.time.Unix()) must be rejected immediately during validation.ErrInvalidEpochorErrExpired/ErrMalformedClaims) when an out-of-bounds timestamp is encountered.1e20), maximum 64-bit integer values (9223372036854775807), and negative values if they represent invalid times.🛠️ Technical Specifications & Context
In Go, JSON numbers are typically parsed as
float64orjson.Number. When converting these values to Unix timestamps usingtime.Unix(), extremely large values can lead to unexpected times due to integer overflow or floating-point truncation.Potential Areas of Modification:
claims.go/validation.go: Locate the validation logic whereexp,nbf, andiatclaims are extracted and verified.float64orjson.Number) falls within a safe Unix timestamp range before passing it totime.Unix().0(or a reasonable minimum like-62135596800for Year 1) and253402300799(December 31, 9999 23:59:59 UTC) to prevent formatting and database compatibility issues, or at least bounded to prevent Go's internaltime.Timerepresentation from overflowing during comparisons (e.g.,time.Now().After(exp)).🧪 Verification & Testing
To verify the fix, add unit tests in the test suite (e.g.,
claims_test.goorvalidation_test.go):Test Case: Maximum Integer Overflow
expset to9223372036854775807.Test Case: Large Floating Point
expset to1e21.Test Case: Valid Large Expiration
2524608000).This repo is using Opire - what does it mean? 👇
💵 Everyone can add rewards for this issue commenting
/reward 100(replace100with the amount).🕵️♂️ If someone starts working on this issue to earn the rewards, they can comment
/tryto let everyone know!🙌 And when they open the PR, they can comment
/claim #1either in the PR description or in a PR's comment.🪙 Also, everyone can tip any user commenting
/tip 20 @heathivorjocelyn6(replace20with the amount, and@heathivorjocelyn6with the user to tip).📖 If you want to learn more, check out our documentation.