Skip to content

fix: auth redirect query encoding#332

Open
drankou wants to merge 1 commit into
mainfrom
investigate-gh-255-url-parameter-injection-in-email-callback-eng-3970
Open

fix: auth redirect query encoding#332
drankou wants to merge 1 commit into
mainfrom
investigate-gh-255-url-parameter-injection-in-email-callback-eng-3970

Conversation

@drankou
Copy link
Copy Markdown
Contributor

@drankou drankou commented May 15, 2026

Summary

Fix auth redirect message handling so query parameters are encoded once via URLSearchParams instead of manually encoding/decoding values across server and client code.

This updates the email callback redirect to use the shared encodedRedirect() helper for message redirects, preventing crafted message values from injecting sibling query parameters.

Changes

  • Extend encodedRedirect() to support message redirects.
  • Let URLSearchParams handle redirect query encoding directly.
  • Replace raw email-callback redirect(...?message=${message}...) calls with encodedRedirect('message', ...).
  • Remove unnecessary decodeURIComponent(...) calls from auth/account message rendering.
  • Add regression coverage for query parameter injection in /api/auth/email-callback.

Closes #255

@cla-bot cla-bot Bot added the cla-signed label May 15, 2026
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 15, 2026

ENG-3970

@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment May 15, 2026 4:49pm
web-juliett Ready Ready Preview, Comment May 15, 2026 4:49pm

Request Review

@drankou drankou marked this pull request as ready for review May 15, 2026 16:52
@drankou drankou requested a review from ben-fornefeld as a code owner May 15, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: URL parameter injection in email callback redirect

1 participant