fix(auth): fail closed on unparseable SIWE Not Before / Expiration - #8875
fix(auth): fail closed on unparseable SIWE Not Before / Expiration#8875SashaMIT wants to merge 1 commit into
Conversation
Invalid Date comparisons are always false in JS, so unparseable invalid_before / expiration_time previously skipped time bounds while signature verification still ran. Signed-off-by: Sasha Mitchell <sash.t.mitchell@gmail.com>
|
|
@SashaMIT is attempting to deploy a commit to the thirdweb Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughLogin payload verification now rejects unparseable ChangesLogin payload validation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
verifyLoginPayloadcomparedcurrentDatetonew Date(invalid_before)/new Date(expiration_time).Invalid Dateare always false, so unparseable times skipped Not Before / Expiration checks while signature verification still ran.Number.isNaN(date.getTime()).Test plan
pnpm exec vitest run src/auth/core/verify-login-payload.test.ts(5 passed), including unparseablenever/ empty string casesMade with Cursor
PR-Codex overview
This PR focuses on enhancing the validation of login payloads by adding checks for unparseable date fields, specifically
invalid_beforeandexpiration_time, ensuring that the payloads are correctly validated and errors are returned for invalid dates.Detailed summary
invalid_beforeandexpiration_timeto handle unparseable dates.Not BeforeandExpiration Timein the payload.expiration_timeandinvalid_before.Summary by CodeRabbit
Bug Fixes
Tests