[PR #6809] [MERGED] fix(auth): respect BETTER_AUTH_TRUSTED_ORIGINS env variable #15144

Closed
opened 2026-04-13 09:51:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6809
Author: @Paola3stefania
Created: 12/16/2025
Status: Merged
Merged: 12/17/2025
Merged by: @Bekacru

Base: canaryHead: fix/trusted-origins-regression


📝 Commits (4)

📊 Changes

2 files changed (+109 additions, -9 deletions)

View changed files

📝 packages/better-auth/src/api/middlewares/origin-check.test.ts (+103 -1)
📝 packages/better-auth/src/auth/base.ts (+6 -8)

📄 Description

FIxes https://github.com/better-auth/better-auth/issues/6798 partially


Summary by cubic

Origin checks now respect the BETTER_AUTH_TRUSTED_ORIGINS env var and merge it with configured trusted origins and the app baseURL. This fixes a regression so sign-in requests from allowed frontends pass and others are blocked.

  • Bug Fixes
    • Include BETTER_AUTH_TRUSTED_ORIGINS alongside dynamic trustedOrigins and baseURL.
    • Add tests for config array acceptance, env-based acceptance, and 403 for untrusted origins.

Written for commit 0db35e1f84. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6809 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 12/16/2025 **Status:** ✅ Merged **Merged:** 12/17/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/trusted-origins-regression` --- ### 📝 Commits (4) - [`f2b81fd`](https://github.com/better-auth/better-auth/commit/f2b81fd78420e9e664ba6b6dd4546e2593341509) fix trusted origins - [`47d2779`](https://github.com/better-auth/better-auth/commit/47d2779174bd363bc5135d0707047b351425adcf) Merge branch 'canary' into fix/trusted-origins-regression - [`16acc58`](https://github.com/better-auth/better-auth/commit/16acc58483161948aa88c59d6092fd2a5326ac07) refactor - [`0db35e1`](https://github.com/better-auth/better-auth/commit/0db35e1f84c1b5ea76d76116efb479d2fbf4894e) fix: test ### 📊 Changes **2 files changed** (+109 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/middlewares/origin-check.test.ts` (+103 -1) 📝 `packages/better-auth/src/auth/base.ts` (+6 -8) </details> ### 📄 Description FIxes https://github.com/better-auth/better-auth/issues/6798 partially <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Origin checks now respect the BETTER_AUTH_TRUSTED_ORIGINS env var and merge it with configured trusted origins and the app baseURL. This fixes a regression so sign-in requests from allowed frontends pass and others are blocked. - **Bug Fixes** - Include BETTER_AUTH_TRUSTED_ORIGINS alongside dynamic trustedOrigins and baseURL. - Add tests for config array acceptance, env-based acceptance, and 403 for untrusted origins. <sup>Written for commit 0db35e1f84c1b5ea76d76116efb479d2fbf4894e. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 09:51:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#15144