Skip to content

Fix: Encode message param in email callback redirect#256

Open
taheerahmed wants to merge 1 commit intoe2b-dev:mainfrom
taheerahmed:fix/email-callback-param-injection
Open

Fix: Encode message param in email callback redirect#256
taheerahmed wants to merge 1 commit intoe2b-dev:mainfrom
taheerahmed:fix/email-callback-param-injection

Conversation

@taheerahmed
Copy link
Contributor

Summary

The message query parameter in /api/auth/email-callback was interpolated into the redirect URL without encoding, enabling query parameter injection.

Change

src/app/api/auth/email-callback/route.tsx — lines 17 and 27:

- redirect(`${next}?message=${message}&type=update_email`)
+ redirect(`${next}?message=${encodeURIComponent(message)}&type=update_email`)

This is consistent with encodedRedirect() used elsewhere in the same file (line 21), which already encodes values properly.

Example

Before: /api/auth/email-callback?message=foo%26error%3Dinjected
→ redirects to /dashboard/account?message=foo&error=injected&type=update_email

After: same input
→ redirects to /dashboard/account?message=foo%26error%3Dinjected&type=update_email

Closes #255

…tion

The message query parameter was interpolated directly into the redirect
URL without encoding. A crafted message value containing & or = could
inject additional query parameters. This is inconsistent with
encodedRedirect() used elsewhere in the same file.

Closes e2b-dev#255
@vercel
Copy link

vercel bot commented Feb 27, 2026

@taheerahmed is attempting to deploy a commit to the E2B Team on Vercel.

A member of the Team first needs to authorize it.

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.

[Bug]: URL parameter injection in email callback redirect

1 participant