chore(deps): update dependency better-auth to v1.4.5 [security] #6238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

This PR contains the following updates:
1.3.27->1.4.5GitHub Vulnerability Alerts
GHSA-569q-mpph-wgww
Summary
Affected versions of Better Auth allow an external request to configure
baseURLwhen it isn’t defined through any other means. This can be abused to poison the router’s base path, causing all routes to return 404 for all users.This issue is only exploitable when
baseURLis not explicitly configured (e.g.,BETTER_AUTH_URLis missing) and the attacker is able to make the very first request to the server after startup. In properly configured environments or typical managed hosting platforms, this fallback behavior cannot be reached.Details
A combination of
X-Forwarded-HostandX-Forwarded-Protois implicitly trusted. This allows the first request to configure baseURL whenever it is not explicitly configured.Here's the code that reads the headers:
Here's the call to
getBaseURL(), the result is assigned toctx.baseURL.Here's the router receiving the poisoned
basePath:X-Forwarded-HostandX-Forwarded-Protocan be used to modify the pathname of a parsed URL object which formsbaseURL.basePathis then derived from the pathname ofbaseURL. Once the routerbasePathis poisoned it fails to match & route incoming requests.Repro
Start a better-auth server with no
baseURLconfiguration.Send the following request as the first request to the server:
The better-auth API check endpoint returns 404.
Now send a regular request without the
X-Forwarded-ProtoandX-Forwarded-Hostheaders.The better-auth API check endpoint still returns 404.
Example result
We have modified the
basePathfor the router until the server is restarted. An attacker can repeatedly send these attack requests aiming to persistently exploit the vulnerability.GHSA-x732-6j76-qmhm
Summary
An issue in the underlying router library rou3 can cause
/pathand//pathto be treated as identical routes. If your environment does not normalize incoming URLs (e.g., by collapsing multiple slashes), this can allow bypasses ofdisabledPathsand path-based rate limits.Details
Better Auth uses better-call, which internally relies on rou3 for routing. Affected versions of rou3 normalize paths by removing empty segments. As a result:
/sign-in/email//sign-in/email///sign-in/email…all resolve to the same route.
Some production setups automatically collapse multiple slashes. This includes:
In these environments and other configurations where
//pathreach Better Auth as/path, the issue does not apply.Fix
Updating rou3 to the latest version resolves the issue:
"rou3": "^0.5.1"(commit: https://github.com/h3js/rou3/commit/f60b43fa648399534507c9ac7db36d705b8874c3)
Better Auth recommends:
Impact
disabledPathsThe impact of bypassing disabled paths could vary based on a project's configuration.
Release Notes
better-auth/better-auth (better-auth)
v1.4.5Compare Source
v1.4.4Compare Source
🚀 Features
🐞 Bug Fixes
View changes on GitHub
v1.4.3Compare Source
🚀 Features
🐞 Bug Fixes
View changes on GitHub
v1.4.2Compare Source
🚀 Features
/authforauth.ts- by @ping-maxwell in #6273 (53a74)🐞 Bug Fixes
View changes on GitHub
v1.4.1Compare Source
🚀 Features
🐞 Bug Fixes
generate-authenticate-optionsfrom POST to GET - by @mburumaxwell in #6199 (f922c)View changes on GitHub
v1.4.0Compare Source
🚀 Features
returnHeaderstogetSession- by @frectonz in #3983 (19d4b)storeStateStrategy- by @himself65 and Copilot in #5470 (b5f3b)search_pathconfiguration - by @okisdev in #5449 (bef33)getAdapter- by @himself65 in #5722 (10249)better-auth/minimal- by @bytaesu and @Bekacru in #5704 (1ebc6)cli- by @Kinfe123 and @himself65 in #4872 (70cb4)AuthClient- by @himself65 in #5815 (7caa2)disableSignalclient option - by @ping-maxwell in #6108 (f4c43)@standard-schema/spec- by @himself65 in #5629 (36315)generateOTP- by @ping-maxwell in #4723 (8ac4f)StripePlugintype - by @himself65 in #5509 (34431)🐞 Bug Fixes
Math.flooraround the division when calculating TTL - by @DevDuki, Dusan Misic, ping-maxwell and @himself65 in #4768 (14b9e)requestPasswordReset- by @Eazash in #5014 (2f94b)options.advanced.generateIdtype - by @himself65 (48249)node:async_hooksdirectly - by @himself65 in #5198 (0717e)whereof type TwoFactorWhereUniqueInput needs at least one ofidarguments - by @AlexStrNik in #5180 (2dab4)exactOptionalPropertyTypes- by @Kinfe123 and @himself65 in #5236 (f2723)ssoClientexport from client plugin - by @Kinfe123 in #5307 (ee229)HookEndpointContextandInternalContext- by @himself65 in #5359 (89475)shatobranchand made itcanaryby default - by @max-programming in #5491 (5bc26)deleteUser- by @ping-maxwell in #5553 (216dc)undefinedtype for optional property types - by @himself65 in #5654 (b6d40)string[]inference for additionalFields - by @GautamBytes in #5778 (414d0)ctxoverrequestin plugin options - by @ping-maxwell in #5944 (448d7)identityinstead ofserialfor pg schema - by @ping-maxwell in #5943 (b3927)/change-emailshould trigger session signal - by @ping-maxwell in #6025 (3abc8)Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.