Require an exp claim in JWTs — reject never-expiring tokens (closes #14)#20
Merged
Conversation
verify_hs256_jwt only checked expiry when exp was present, so a validly-signed token that omits exp was accepted indefinitely. JWTs have no revocation, so a captured no-exp token would be a permanent credential. Now a missing exp is rejected with 'JWT missing exp'. mint_hs256_jwt/mint_rs256_jwt always set exp, so legitimate issuance is unaffected. 3 tests. Closes #14.
🛫 Volo reliability — ❌ NO-SHIPReplayed 7 adversarial scenarios against the agent (threshold ≥ 0.90).
Cost — replayed deterministically at $0 (no live API calls). baseline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14. Security hardening.
verify_hs256_jwtonly checked expiry whenexpwas present, so a validly-signed token that omitsexpwas accepted indefinitely. JWTs have no revocation, so a captured no-exptoken would be a permanent credential.Fix
A missing/invalid
expis now rejected withAccessDenied('JWT missing exp').mint_hs256_jwt/mint_rs256_jwtalways setexp, so legitimate issuance is unaffected.Tests
3: a validly-signed no-
exptoken is rejected; a normal token still verifies; an expired token still rejected. Cloud suite 25 passed, mypy + ruff clean.Note: overlaps trivially with #6 (RS256), which factors this check into
_validate_claims— whichever merges second is a one-line reconcile.