Enforce JWT exp claim in jwt.verify (GHSA-5324-c68v-8w62 / CVE-2026-53777)

fix(stdlib): enforce JWT exp claim in jwt.verify (GHSA-5324-c68v-8w62 / CVE-2026-53777) (#5008)
Enforce JWT exp claim in jwt.verify (GHSA-5324-c68v-8w62 / CVE-2026-53777)7e29d6-fix-enforce-jwt-exp-claim-in-jwt-cve-2026-53776fixenforce jwt exp claim verify ghsa

Committed by proggeramlug

commit message
fix(stdlib): enforce JWT exp claim in jwt.verify (GHSA-5324-c68v-8w62 / CVE-2026-53777) (#5008)

verify_decode — the shared helper behind every jwt.verify() path (HS256,
ES256, RS256, and the dyn dispatchers) — set validation.validate_exp = false,
so expired tokens were accepted indefinitely as long as the signature was
valid. This silently broke session expiry as an auth control and inverts the
default of the Node jsonwebtoken package perry mirrors.
 
Set validate_exp = true so an expired exp claim is rejected. required_spec_claims
stays empty, so tokens that legitimately omit exp still verify (matching Node:
exp is enforced when present, not required). This applies uniformly across all
verify entry points since they share verify_decode.
 
Tests: expired token rejected, unexpired accepted, no-exp token still accepted.
 
Note: a per-call { ignoreExpiration: true } opt-out (Node-compatible) is a
follow-up — it needs the codegen options-lowering to thread the flag (the
inline-literal path currently drops unknown options), plus an FFI ABI change.
Out of scope for this security fix, which makes the default safe.
 
Co-authored-by: Ralph Küpper <[email protected]>

Editor assessment

This commit patches CVE-2026-53776. The body is genuinely instructive: it traces verify_decode as the shared helper behind every verify path, explains that validate_exp=false made expired tokens acceptable, and justifies leaving required_spec_claims empty so exp stays optional but enforced when present. It even scopes out a per-call ignoreExpiration opt-out with reasons. The header undercuts all that—nearly 100 characters, padded with a GHSA ID, a differently numbered CVE, and PR 5008—so the suffix reads as ticket debris rather than a subject. No footer records the advisory formally. Excellent explanation trapped in an overlong, advisory-laden subject. The subject cites CVE-2026-53777 instead, so the mapping differs.

Browse categories

More fix examples · Back to search