[PR #6787] [MERGED] chore: dispaly warning when baseURL isn't available #6882

Closed
opened 2026-03-13 13:15:19 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6787
Author: @Bekacru
Created: 12/15/2025
Status: Merged
Merged: 12/19/2025
Merged by: @Bekacru

Base: canaryHead: fix/base-url


📝 Commits (6)

📊 Changes

5 files changed (+606 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/api/index.ts (+1 -0)
📝 packages/better-auth/src/api/to-auth-endpoints.test.ts (+277 -1)
📝 packages/better-auth/src/context/create-context.ts (+6 -0)
packages/better-auth/src/utils/url.test.ts (+263 -0)
📝 packages/better-auth/src/utils/url.ts (+59 -1)

📄 Description

  • Display warning when
  • Add more tests for base url, disabled paths

closes #6780


Summary by cubic

Adds a warning when baseURL can’t be determined and hardens path/URL handling to prevent disabled path bypasses and unsafe proxy header usage. Improves reliability of redirects/callbacks and blocks common encoded path and traversal tricks.

  • New Features

    • Logs an error when baseURL is missing, with guidance to configure baseURL or BETTER_AUTH_BASE_URL.
  • Bug Fixes

    • Normalizes and double-decodes request paths to enforce disabledPaths, returning 404 for encoded slash and traversal variants.
    • Validates X-Forwarded-Host/Proto only when trustedProxyHeaders is true; accepts only http/https and safe host formats, otherwise falls back to the request URL.
    • Adds comprehensive tests for baseURL resolution, disabled paths, and proxy header edge cases.

Written for commit 1bde5775da. 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/6787 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 12/15/2025 **Status:** ✅ Merged **Merged:** 12/19/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/base-url` --- ### 📝 Commits (6) - [`2025b4b`](https://github.com/better-auth/better-auth/commit/2025b4b73342138cc2f0c1d3ca2ee7331f7556ac) add logs - [`05a982b`](https://github.com/better-auth/better-auth/commit/05a982ba4d6e64bfa6df3668a457b6489717bc87) add test - [`b8cb57c`](https://github.com/better-auth/better-auth/commit/b8cb57cf72c0be1c7aa6b2c34e257b3a71296264) remove fluff - [`aef2f23`](https://github.com/better-auth/better-auth/commit/aef2f2312d4d37a7698f676c07111eb69fa55de9) remove duplicate test - [`85d82c8`](https://github.com/better-auth/better-auth/commit/85d82c811aa00eb82d87f888b0a9d2b7f5aea5d0) chore: lint - [`1bde577`](https://github.com/better-auth/better-auth/commit/1bde5775da1c59d2f8175dd64ad378fc9e370441) remove ### 📊 Changes **5 files changed** (+606 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/index.ts` (+1 -0) 📝 `packages/better-auth/src/api/to-auth-endpoints.test.ts` (+277 -1) 📝 `packages/better-auth/src/context/create-context.ts` (+6 -0) ➕ `packages/better-auth/src/utils/url.test.ts` (+263 -0) 📝 `packages/better-auth/src/utils/url.ts` (+59 -1) </details> ### 📄 Description - Display warning when - Add more tests for base url, disabled paths closes #6780 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a warning when baseURL can’t be determined and hardens path/URL handling to prevent disabled path bypasses and unsafe proxy header usage. Improves reliability of redirects/callbacks and blocks common encoded path and traversal tricks. - **New Features** - Logs an error when baseURL is missing, with guidance to configure baseURL or BETTER_AUTH_BASE_URL. - **Bug Fixes** - Normalizes and double-decodes request paths to enforce disabledPaths, returning 404 for encoded slash and traversal variants. - Validates X-Forwarded-Host/Proto only when trustedProxyHeaders is true; accepts only http/https and safe host formats, otherwise falls back to the request URL. - Adds comprehensive tests for baseURL resolution, disabled paths, and proxy header edge cases. <sup>Written for commit 1bde5775da1c59d2f8175dd64ad378fc9e370441. 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-03-13 13:15:19 -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#6882