Skip to content

fix: use explicit None checks for JWT exp validation#3724

Merged
jlowin merged 1 commit intomainfrom
fix/jwt-exp-truthiness-check
Mar 31, 2026
Merged

fix: use explicit None checks for JWT exp validation#3724
jlowin merged 1 commit intomainfrom
fix/jwt-exp-truthiness-check

Conversation

@jlowin
Copy link
Copy Markdown
Member

@jlowin jlowin commented Mar 31, 2026

JWT expiration checks in jwt_issuer.py, providers/jwt.py, and providers/introspection.py used Python truthiness (if exp and exp < time.time()) instead of explicit None checks. This meant exp=0 would silently skip the expiration check rather than correctly treating it as expired.

Same issue affected expires_at assignment (int(exp) if exp else None) which would discard a legitimate exp=0 value.

The exp checks used Python truthiness (`if exp and ...`, `if exp else`)
which silently passes when exp is 0 or missing.
@jlowin jlowin added the bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. label Mar 31, 2026
@marvin-context-protocol marvin-context-protocol Bot added the auth Related to authentication (Bearer, JWT, OAuth, WorkOS) for client or server. label Mar 31, 2026
@jlowin jlowin merged commit 61f3fee into main Mar 31, 2026
14 of 15 checks passed
@jlowin jlowin deleted the fix/jwt-exp-truthiness-check branch March 31, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Related to authentication (Bearer, JWT, OAuth, WorkOS) for client or server. bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant