Skip to content

[Bug]: URL parameter injection in email callback redirect #255

@taheerahmed

Description

@taheerahmed

Summary

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

Actual behavior

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

A crafted URL like /api/auth/email-callback?message=foo%26error%3Dinjected would produce:

/dashboard/account?message=foo&error=injected&type=update_email

The &error=injected part breaks out of the message parameter and injects an additional query param. This is inconsistent with encodedRedirect() used elsewhere in the same file (line 21), which properly encodes values.

Expected behavior

The message value should be encoded before interpolation to prevent parameter injection.

Fix

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

Both redirect calls on lines 17 and 27 are affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions