Skip to content

Raise JWTClaimsError for non-numeric exp/iat/nbf claims - #426

Closed
Eryx-Z wants to merge 1 commit into
mpdavis:masterfrom
Eryx-Z:fix/time-claim-overflow-typeerror
Closed

Eryx-Z wants to merge 1 commit into
mpdavis:masterfrom
Eryx-Z:fix/time-claim-overflow-typeerror

Conversation

@Eryx-Z

@Eryx-Z Eryx-Z commented Oct 16, 2026

Copy link
Copy Markdown

Description

jose.jwt.decode() documents that bad claims raise JWTError / JWTClaimsError. For exp, iat, and nbf, only ValueError from int() was caught. Values such as Infinity (OverflowError) or a JSON array/object (TypeError) therefore propagated uncaught and broke callers that only handle JWTError.

Catch (ValueError, TypeError, OverflowError) in _validate_exp, _validate_iat, and _validate_nbf.

Test

Added TestTimeClaimTypeErrors covering infinity, overflowing floats, lists, and dicts for all three claims.

Closes #420

int() on Infinity or structured JSON values raises OverflowError or
TypeError, which escaped jose.jwt.decode() even though the documented
contract is JWTClaimsError. Catch those alongside ValueError.

Closes mpdavis#420
@Eryx-Z

Eryx-Z commented Oct 17, 2026

Copy link
Copy Markdown
Author

Closing for now.

@Eryx-Z Eryx-Z closed this Oct 17, 2026
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.

[Vuln] Uncaught OverflowError / TypeError in jwt.decode() time-claim validation

1 participant