Skip to content

chore(deps): update dependency better-auth to ^1.3.4 [security]#1228

Open
renovate[bot] wants to merge 1 commit intomainfrom
renovate/npm-better-auth-vulnerability
Open

chore(deps): update dependency better-auth to ^1.3.4 [security]#1228
renovate[bot] wants to merge 1 commit intomainfrom
renovate/npm-better-auth-vulnerability

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Feb 10, 2026

ℹ️ Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Confidence
better-auth (source) ^1.4.18^1.3.4 age confidence

GitHub 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 baseURL when 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 baseURL is not explicitly configured (e.g., BETTER_AUTH_URL is 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-Host and X-Forwarded-Proto is implicitly trusted. This allows the first request to configure baseURL whenever it is not explicitly configured.

Here's the code that reads the headers:

headers

Here's the call to getBaseURL(), the result is assigned to ctx.baseURL.

write

Here's the router receiving the poisoned basePath:

router

X-Forwarded-Host and X-Forwarded-Proto can be used to modify the pathname of a parsed URL object which forms baseURL. basePath is then derived from the pathname of baseURL. Once the router basePath is poisoned it fails to match & route incoming requests.

Repro

Start a better-auth server with no baseURL configuration.

Send the following request as the first request to the server:

curl -i --location 'https://example.com/api/auth/ok' \
--header 'X-Forwarded-Proto: some:' \
--header 'X-Forwarded-Host: junk'

The better-auth API check endpoint returns 404.

Now send a regular request without the X-Forwarded-Proto and X-Forwarded-Host headers.

curl -i --location 'https://example.com/api/auth/ok'

The better-auth API check endpoint still returns 404.

Example result

attack

We have modified the basePath for 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 /path and //path to be treated as identical routes. If your environment does not normalize incoming URLs (e.g., by collapsing multiple slashes), this can allow bypasses of disabledPaths and 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 //path reach Better Auth as /path, the issue does not apply.

Fix

Updating rou3 to the latest version resolves the issue:

Better Auth recommends:

  1. Upgrading to Better Auth v1.4.5 or later, which includes the updated rou3.
  2. Ensuring the proxy normalizes URLs.
  3. If project maintainers cannot upgrade yet, they can protect their app by normalizing url before it reaches better-auth handler. See example below:
const req = new Request(...) // this would be the actual request object
const url = new URL(req.url);
const normalizedPath = url.pathname.replace(/\/+/g, "/");

if (url.pathname !== normalizedPath) {
  url.pathname = normalizedPath;
  // Update the raw request pathname
  Object.defineProperty(req, "url", {
    value: url.toString(),
    writable: true,
    configurable: true,
  });
}

Impact

  • Bypass disabledPaths
  • Bypass path-based rate limits

The impact of bypassing disabled paths could vary based on a project's configuration.


Release Notes

better-auth/better-auth (better-auth)

v1.4.5

Compare Source

v1.4.4

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.4.3

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.4.2

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.4.1

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.4.0

Compare Source

   🚀 Features
   🐞 Bug Fixes

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.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@changeset-bot
Copy link

changeset-bot bot commented Feb 10, 2026

⚠️ No Changeset found

Latest commit: 2a227fa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch 12 times, most recently from 81c1c6b to 318632d Compare February 17, 2026 13:37
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch 16 times, most recently from 4a347e0 to 98cf683 Compare February 24, 2026 18:19
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch 10 times, most recently from 03b00e9 to e9e4860 Compare March 9, 2026 12:52
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch 5 times, most recently from 9b6b3b1 to 52e2e3a Compare March 13, 2026 15:25
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5dbd0da5-6e14-4b25-bf32-9fc7599eda41

📥 Commits

Reviewing files that changed from the base of the PR and between 0b5a3ef and 6cf20e9.

📒 Files selected for processing (1)
  • examples/react/projects/package.json

📝 Walkthrough

Walkthrough

A single dependency version change: better-auth in examples/react/projects/package.json was changed from ^1.4.18 to ^1.3.4.

Changes

Cohort / File(s) Summary
Dependency Version Update
examples/react/projects/package.json
Downgraded better-auth from ^1.4.18 to ^1.3.4.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I nibble on commits beneath moonlight,
A gentle hop, a version slight,
Better-auth steps back in time,
1.3.4 — a snug little rhyme. 🐰✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning PR description is incomplete; required sections from template (Changes, Checklist, Release Impact) are missing or not filled out properly. Complete the PR template by adding a 'Changes' section describing the update, checking relevant checklist items, and indicating release impact (e.g., whether a changeset is needed).
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly describes the main change: updating better-auth dependency to ^1.3.4 and notes security impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch renovate/npm-better-auth-vulnerability
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/react/projects/package.json`:
- Line 29: Update the better-auth dependency in the manifest from "^1.3.4" to
"^1.4.5" so the package.json floor addresses GHSA-x732-6j76-qmhm and the other
advisories, then regenerate the lockfile (npm/yarn/pnpm lock) so the lock
reflects a single resolved version (remove/replace the 1.3.4 entry and ensure
only the 1.4.x entry, e.g., 1.4.18, is present); target the package.json
"better-auth" entry and the repo lockfile(s) to keep them consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c4eedec-9564-4ff0-aba8-2d4712748df8

📥 Commits

Reviewing files that changed from the base of the PR and between c3e6a96 and 52e2e3a.

📒 Files selected for processing (1)
  • examples/react/projects/package.json

"@trpc/client": "^11.10.0",
"@trpc/server": "^11.10.0",
"better-auth": "^1.4.18",
"better-auth": "^1.3.4",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify manifest vs lockfile spec and resolved entries for better-auth
rg -n '"better-auth"\s*:' examples/react/projects/package.json
fd pnpm-lock.yaml --exec rg -n 'better-auth(@|:)' {}

Repository: TanStack/db

Length of output: 318


🌐 Web query:

What are the patched version ranges for better-auth for CVE-2025-61928, GHSA-569q-mpph-wgww, and GHSA-x732-6j76-qmhm, and do they require >=1.4.5?

💡 Result:

Vulnerability Vulnerable (affected) better-auth versions Patched / fixed better-auth versions Requires >= 1.4.5?
CVE-2025-61928 < 1.3.26 >= 1.3.26 No (1.3.26 is sufficient) [1]
GHSA-569q-mpph-wgww < 1.4.2 >= 1.4.2 No (1.4.2 is sufficient) [2]
GHSA-x732-6j76-qmhm < 1.4.5 >= 1.4.5 Yes [3]

If you upgrade to better-auth >= 1.4.5, you’ll be patched for all three. [3]

Sources: [1] [2] [3]


Keep better-auth ≥ 1.4.5 to fix all three advisories; resolve lockfile mismatch.

At Line 29, the change to ^1.3.4 introduces a regression. While this floor fixes CVE-2025-61928 (patched ≥ 1.3.26) and GHSA-569q-mpph-wgww (patched ≥ 1.4.2), it leaves GHSA-x732-6j76-qmhm vulnerable (requires ≥ 1.4.5). Given the PR explicitly references these advisories, the version floor should be at least ^1.4.5.

Additionally, the lockfile currently contains both 1.4.18 and 1.3.4 entries but the manifest specifies ^1.3.4, causing misalignment that must be resolved.

Proposed fix
-    "better-auth": "^1.3.4",
+    "better-auth": "^1.4.5",

Then regenerate the lockfile to match.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"better-auth": "^1.3.4",
"better-auth": "^1.4.5",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/react/projects/package.json` at line 29, Update the better-auth
dependency in the manifest from "^1.3.4" to "^1.4.5" so the package.json floor
addresses GHSA-x732-6j76-qmhm and the other advisories, then regenerate the
lockfile (npm/yarn/pnpm lock) so the lock reflects a single resolved version
(remove/replace the 1.3.4 entry and ensure only the 1.4.x entry, e.g., 1.4.18,
is present); target the package.json "better-auth" entry and the repo
lockfile(s) to keep them consistent.

@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from 52e2e3a to 0b5a3ef Compare March 13, 2026 15:42
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
examples/react/projects/package.json (1)

29-29: ⚠️ Potential issue | 🔴 Critical

Block this security-floor downgrade for better-auth.

At Line 29, changing to ^1.3.4 weakens the minimum version in a security PR and leaves CI broken due to manifest/lockfile mismatch (^1.3.4 vs ^1.4.18). Keep the floor at ^1.4.5 or higher and regenerate the lockfile so both are aligned.

Proposed fix
-    "better-auth": "^1.3.4",
+    "better-auth": "^1.4.5",
#!/bin/bash
# Verify manifest value + lockfile alignment for better-auth (read-only).
rg -n '"better-auth"\s*:' examples/react/projects/package.json
fd 'pnpm-lock.yaml|package-lock.json|yarn.lock' -t f --exec rg -n 'better-auth(@|:)|"better-auth"\s*:'
What are the patched version ranges for better-auth advisories CVE-2025-61928, GHSA-569q-mpph-wgww, and GHSA-x732-6j76-qmhm, and which minimum version fixes all three?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/react/projects/package.json` at line 29, The PR lowered the minimum
allowed version for the dependency "better-auth" from the security floor ^1.4.5
to ^1.3.4, causing a manifest/lockfile mismatch and weakening security; revert
the package.json entry for "better-auth" to ^1.4.5 (or a higher patched minimum)
and regenerate the repository lockfile for the project's package manager
(pnpm/yarn/npm) so the lockfile and manifest match, then run an install to
update the lockfile and commit both updated package.json and the regenerated
lockfile to the branch so CI is consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@examples/react/projects/package.json`:
- Line 29: The PR lowered the minimum allowed version for the dependency
"better-auth" from the security floor ^1.4.5 to ^1.3.4, causing a
manifest/lockfile mismatch and weakening security; revert the package.json entry
for "better-auth" to ^1.4.5 (or a higher patched minimum) and regenerate the
repository lockfile for the project's package manager (pnpm/yarn/npm) so the
lockfile and manifest match, then run an install to update the lockfile and
commit both updated package.json and the regenerated lockfile to the branch so
CI is consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 23adf980-1538-43ce-8237-b1825d890257

📥 Commits

Reviewing files that changed from the base of the PR and between 52e2e3a and 0b5a3ef.

📒 Files selected for processing (1)
  • examples/react/projects/package.json

@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch 9 times, most recently from 8dd5de6 to a246bec Compare March 16, 2026 12:22
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from a246bec to 2a227fa Compare March 16, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants