security: prevent open redirect in /auth/confirm#74
Conversation
The 'next' query parameter was passed directly to NextResponse.redirect without validation. An attacker could craft a confirmation link with next=https://evil.com, redirecting the user to a phishing site after successful OTP verification. Validate that 'next' starts with '/' (relative path) and does not start with '//' (protocol-relative URL). Fall back to /auth/callback if the value is invalid.
|
@roshanraj9136 is attempting to deploy a commit to the OpenLake_Website Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
More reviews will be available in 10 minutes and 19 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 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 |
Vulnerability
The
/auth/confirmroute accepts anextquery parameter and redirects to it after OTP verification succeeds:An attacker can craft a magic-link confirmation URL like:
After the user clicks and their OTP verifies, they are redirected to the attacker's site. This enables phishing (fake login page to harvest credentials) or session theft.
Fix
Validate that
nextis a relative path:///(protocol-relative URL, e.g.//evil.com)/auth/callbackif invalidFile changed (1)
src/app/auth/confirm/route.ts— 2 insertions, 1 deletion