chore(deps): update dependency better-auth to v1.4.2 [security] #2468
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.7->1.4.2GitHub Vulnerability Alerts
CVE-2025-61928
Summary
A critical authentication bypass was identified in the API key creation and update endpoints. An attacker could create or modify API keys for arbitrary users by supplying a victim’s user ID in the request body. Due to a flaw in how the authenticated user was derived, the endpoints could treat attacker-controlled input as an authenticated user object under certain conditions.
Details
The vulnerability originated from fallback logic used when determining the current user. When no session was present, the handler incorrectly allowed request-body data to populate the user context used for authorization decisions. Because server-side validation only executed when authentication was required, privileged fields were not properly protected. As a result, the API accepted unauthenticated requests that targeted other users.
This same pattern affected both the API key creation and update routes.
Impact
Unauthenticated attackers could generate or modify API keys belonging to any user. This granted full authenticated access as the targeted user and, depending on the user’s privileges, could lead to account compromise, access to sensitive data, or broader application takeover.
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.Release Notes
better-auth/better-auth (better-auth)
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)null- by @ping-maxwell in #5036 (68608)ends_withquery - by @ping-maxwell in #5160 (cd006)CamelCasePluginbreaks for OIDC. - by @ping-maxwell in #5078 (e9157)defaultValueduringfindcalls - by @ping-maxwell in #5779 (97c97)deleteManyresult should be a number - by @ping-maxwell in #5682 (191f1)ctxon accountLink - by @ping-maxwell in #5389 (0b0de)isAnonymousshould default to false instead of null - by @ping-maxwell in #6026 (da374)Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ 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.