-
Notifications
You must be signed in to change notification settings - Fork 2
fix: use constant-time comparison for HMAC signatures to prevent timing attacks #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ng attacks Replace non-constant-time string comparisons with crypto.timingSafeEqual to prevent timing attacks that could leak secret information: - OAuth state signature verification (google/callback/route.ts) - Cron secret authentication (cleanup-tokens/route.ts) - WebSocket fingerprint verification (ws-security.ts) These vulnerabilities are similar to historical timing attacks like the Xbox 360 bootloader HMAC bypass (2007-2008) and OAuth/OpenID library vulnerabilities (2010) where byte-by-byte comparisons leaked timing information that allowed attackers to forge valid signatures.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughReplaces ad-hoc string comparisons with Node.js Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (3)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx,js,jsx,json}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (1)📓 Common learnings⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
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 |
… of static replacement The previous test replaced the last ciphertext byte with 'FF', which had a 1/256 chance of being a no-op if the byte was already 'FF'. This caused flaky test failures in CI. Now we XOR with 0x01 to guarantee the byte changes.
Replace non-constant-time string comparisons with crypto.timingSafeEqual
to prevent timing attacks that could leak secret information:
These vulnerabilities are similar to historical timing attacks like the
Xbox 360 bootloader HMAC bypass (2007-2008) and OAuth/OpenID library
vulnerabilities (2010) where byte-by-byte comparisons leaked timing
information that allowed attackers to forge valid signatures.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.