fix(jwt): enforce exp validation in perry-ext-jsonwebtoken verify#5072
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR enforces JWT expiry claim validation in the perry JSON Web Token extension. The ChangesJWT Expiry Validation Security Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
What
Sets
validation.validate_exp = trueinjs_jwt_verify(crates/perry-ext-jsonwebtoken/src/lib.rs), matching the stdlib implementation.Why
The ext crate's verify path had
validate_exp = false, accepting expired JWTs indefinitely — the exact pattern already fixed incrates/perry-stdlib/src/jsonwebtoken.rsfor GHSA-5324-c68v-8w62 / CVE-2026-53777. The active dispatch forimport 'jsonwebtoken'routes to the (fixed) stdlib, so this was a latent/dead-code regression rather than a live bypass — but leaving a vulnerable copy of an auth primitive in-tree is a footgun. This flips it and keeps the two implementations consistent.required_spec_claimsstays empty, so this preserves Node parity: a token whoseexpis in the past is rejected, while a token that omitsexpstill verifies.Test
Two new unit tests:
verify_rejects_expired_tokenandverify_accepts_token_without_exp.cargo test -p perry-ext-jsonwebtoken→ 5 passed.Follow-up (out of scope)
Whether
perry-ext-jsonwebtoken(and the siblingperry-ext-bcrypt/perry-ext-argon2crates) are a live pluggable-backend design or dead code to remove is a separate decision, noted in #5066.Closes #5066
Summary by CodeRabbit