Origin Check Middleware Fails with Query Parameters in Relative URLs #1068

Closed
opened 2026-03-13 08:21:08 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @ejscheepers on GitHub (Apr 17, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Ex:

  1. Add url parameter to redirectTo field of forgetPassword
  2. Try to send forget password email
  3. It works if you add in base url manually

Current vs. Expected behavior

Currently you get error that full url including url parameters is not trusted origin, should strip parameters and then check.

What version of Better Auth are you using?

1.2.7

Provide environment information

- Browser Safari

Which area(s) are affected? (Select all that apply)

Package

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

Image Image
Originally created by @ejscheepers on GitHub (Apr 17, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Ex: 1. Add url parameter to redirectTo field of forgetPassword 2. Try to send forget password email 3. It works if you add in base url manually ### Current vs. Expected behavior Currently you get error that full url including url parameters is not trusted origin, should strip parameters and then check. ### What version of Better Auth are you using? 1.2.7 ### Provide environment information ```bash - Browser Safari ``` ### Which area(s) are affected? (Select all that apply) Package ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context <img width="736" alt="Image" src="https://github.com/user-attachments/assets/1e773d65-f18b-4ae0-9a4d-536fbe789658" /> <img width="636" alt="Image" src="https://github.com/user-attachments/assets/8741301d-fef8-4393-8cc2-b5b9d8ca1c52" />
GiteaMirror added the bug label 2026-03-13 08:21:08 -05:00
Author
Owner

@Bekacru commented on GitHub (Apr 17, 2025):

the issue isn't having a query param but the "@" symbol. It'll be fixed.

@Bekacru commented on GitHub (Apr 17, 2025): the issue isn't having a query param but the "@" symbol. It'll be fixed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1068