Skip to content

security: prevent open redirect in /auth/confirm#74

Merged
Ashish-Kumar-Dash merged 1 commit into
OpenLake:mainfrom
roshanraj9136:fix/open-redirect-auth-confirm
Jun 13, 2026
Merged

security: prevent open redirect in /auth/confirm#74
Ashish-Kumar-Dash merged 1 commit into
OpenLake:mainfrom
roshanraj9136:fix/open-redirect-auth-confirm

Conversation

@roshanraj9136

Copy link
Copy Markdown
Contributor

Vulnerability

The /auth/confirm route accepts a next query parameter and redirects to it after OTP verification succeeds:

const next = searchParams.get('next') ?? '/auth/callback'
return NextResponse.redirect(new URL(next, request.url))

An attacker can craft a magic-link confirmation URL like:

/auth/confirm?token_hash=...&type=email&next=https://evil.com

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 next is a relative path:

  • Must start with /
  • Must NOT start with // (protocol-relative URL, e.g. //evil.com)
  • Falls back to /auth/callback if invalid

File changed (1)

src/app/auth/confirm/route.ts — 2 insertions, 1 deletion

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.
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

@roshanraj9136 is attempting to deploy a commit to the OpenLake_Website Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@roshanraj9136, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4e231c75-0004-4fd6-9364-68edfe4aa775

📥 Commits

Reviewing files that changed from the base of the PR and between cd02e34 and 0beaf13.

📒 Files selected for processing (1)
  • src/app/auth/confirm/route.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Ashish-Kumar-Dash Ashish-Kumar-Dash merged commit 7c4cebf into OpenLake:main Jun 13, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants