Auth hardening: open redirect, missing secure flag, weak timing comparison#68
Open
Auth hardening: open redirect, missing secure flag, weak timing comparison#68
Conversation
Co-authored-by: NiveditJain <40313233+NiveditJain@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix authentication security vulnerabilities including open redirect
Auth hardening: open redirect, missing secure flag, weak timing comparison
Feb 26, 2026
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.
Addresses three security issues in
app/actions/auth.ts: open redirect via unvalidatedredirectTo, session cookies missing thesecureflag in production, and a custom timing-safe comparison weaker than the stdlib equivalent.Changes
redirectTois now validated to only accept paths starting with/and not//; anything else falls back to"/"claudeye_sessionandclaudeye_authnow setsecure: process.env.NODE_ENV === "production"crypto.timingSafeEqual— replaced the custom XOR loop with Node.jscrypto.timingSafeEqual; strings are converted toBufferbefore comparison, with a dummy self-comparison when lengths differ to preserve constant-time behaviourTests covering the redirect validation and
secureflag behaviour are added in__tests__/actions/auth.test.ts.Type of Change
Checklist
npm run lintpassesnpx tsc --noEmitpassesnpm run test:runpassesnpm run buildsucceedsOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.