Skip to content

[Chore] Patch Better Auth and preserve sign-in - #3734

Merged
daniel-lxs merged 2 commits into
developfrom
fix/better-auth-advisories-10juoosbwyk26
Nov 22, 2026
Merged

daniel-lxs merged 2 commits into
developfrom
fix/better-auth-advisories-10juoosbwyk26

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

​Opened on behalf of @daniel-lxs. View the session or mention @roomote-roomote for follow-up asks.

Related issue

Addresses GHSA-9hm7-xhfp-cx58 and GHSA-hwq2-v29r-p69r. Both advisories identify 1.7.16 as the first patched stable release.

Why this PR exists

  • A maintainer explicitly invited this PR in the linked issue or discussion
  • I am a maintainer / this is internal Roomote work

Requested security upgrade with sign-in evidence and a condition-by-condition exposure assessment. The reported 1.6.22 premise is stale: inspected develop and the installed graph were 1.7.12, following the main Roomote migration in #3636. No equivalent open 1.7.16 upgrade was found. Roomote-Cloud is a separate application and was not used to infer this application's behavior.

What changed

  • Raise better-auth and direct @better-auth/drizzle-adapter floors to ^1.7.25; align core, telemetry, and all bundled adapters (Drizzle, Kysely, memory, MongoDB, Prisma) at 1.7.25 in the generated lockfile.
  • Update only necessary auth transitives: utils 0.5.0→0.5.1, Better Fetch 1.3.2→1.3.3, Better Call 1.4.4→1.4.5. ORM/Kysely versions and dependency overrides are unchanged.
  • Preserve minimumReleaseAge: 10080, its existing exclusions, and blockExoticSubdeps. All 11 new package resolutions independently pass the seven-day age requirement. 1.7.25 was the newest stable version eligible under that policy at resolution time.
  • Add actual-library/PostgreSQL regressions for false-like OAuth verification strings, a configured generic GitLab callback against a local HTTP provider, and stale email-change links after address reuse. Existing legacy callback, Microsoft identity/verification, explicit linking, and session-renewal coverage remains in place. No additional application compatibility or schema changes were required.

Advisory conditions and deployment assessment

Evidence boundary: The following repository evidence describes this PR's base (c515059f5), not verified production configuration. A read-only deployment-access probe failed; production's installed version/SHA, effective environment/database-backed provider settings, email channel/sender, upstream claims, invites and historical address reuse were not verified. The sandbox is not production. Therefore production exposure to either advisory is unknown, not established by these defaults. A deployment running this PR's 1.7.25 graph is outside both advisories' affected ranges.

GHSA-9hm7-xhfp-cx58 — OAuth verification/profile identity

Upstream lists three alternative provider conditions, with an exception for intentionally trusted email-linking providers.

Condition Repository evidence Verified deployed result
Affected version and OAuth sign-in in use Base 1.7.12 is affected. auth.ts conditionally configures generic Slack/GitLab/Gitea/Bitbucket/ADO from effective credentials; Microsoft is added separately by auth-oauth-compatibility.ts. Unknown version/SHA and enabled providers.
Provider returns a string verification claim and lets someone hold someone else's address unverified Slack helper forwards email_verified; Microsoft compatibility mapping forwards the optional claim. Thus raw string values could reach core. GitLab explicitly returns a boolean derived from confirmed_at; Gitea/Bitbucket/ADO return false. No Cognito provider is configured. Source does not establish actual Slack/Microsoft claim types or their address-ownership rules. Unknown upstream claim types and unverified-address policy; no demonstrated deployed takeover path.
genericOAuth() provider has a JWKS endpoint; mismatched userinfo/ID-token subjects or submitted access-token profile Generic providers configure explicit endpoints/custom userinfo, without discoveryUrl or a configured/discovered jwks_uri. This particular generic-JWKS condition is not met by the checked-in configuration. Microsoft's separate built-in wrapper explicitly verifies token signature/issuer/audience/expiry/tenant/nonce and binds userinfo sub. Production SHA/config unverified; no claim that it matches source.
Zoom with disableSignUp, requireEmailVerification, or overrideUserInfoOnSignIn No Zoom provider or Zoom options in this application's auth factory. This alternative is not met in source. Production SHA/config unverified.
Exception: provider listed in account.accountLinking.trustedProviders No static trusted-provider list. Explicit link trust is narrowly gated by authenticated, server-stamped OAuth state; it is not blanket trust for unauthenticated sign-in. allowDifferentEmails: true does not establish that exception. Effective deployed behavior unverified.
Local-email guard for implicit email linking Both 1.7.12 and 1.7.25 default requireLocalEmailVerified to true. This application does not override it, so the existing local account must also be verified for this implicit-linking path. Production SHA/config and target-account verification state unknown.

For the email-linking impact, an existing verified local account must own the address and an untrusted provider profile must be accepted as verified; new users can also be incorrectly stored verified. The revised Slack regression explicitly verifies and asserts the local email/password account before sign-in, rejects "false", "0", "unverified" and boolean false, and asserts no linked account or session. Boolean true and string "true" controls must successfully link and receive the same user's session. The original fixture's unverified-local-email guard masked provider-claim parsing; review finding #4659006341 was valid and corrected in bd8df4663. Normal explicit linking and returning linked identities still pass.

GHSA-hwq2-v29r-p69r — email-change link address reuse

All three configuration conditions are required, plus the address-reuse race while an old link is valid.

Condition Repository evidence Verified deployed result
Affected version (>=1.4.0, <1.7.16) Base 1.7.12 is affected; this PR resolves 1.7.25. Installed production version unknown.
user.changeEmail.enabled Unconditionally true in auth.ts. Production SHA/config unverified.
emailVerification.sendVerificationEmail configured Only configured when isEmailChannelEnabled() is true (R_EMAIL_CHANNEL_ENABLED is opt-in). Sends via AgentMail; successful delivery is a separate operational requirement. Flag, sender readiness and actual delivery unknown.
New user can register an old owner's released address No permanent address tombstone in this flow; valid invite/setup/admission and R_ALLOWED_EMAILS restrictions still apply. Reuse is possible for an admitted signup; anonymous unrestricted registration is not assumed. Actual admission configuration, valid invites and address reuse unknown.
Attacker controls relevant addresses, obtains a change link, changes away, and victim registers the old address before that link expires, then the old link is opened without a session This timing/ownership history cannot be established from source. The regression deliberately creates that sequence, with admission and mail delivery fixtures, using real auth and PostgreSQL. No incident or exploitation claim; timing and address history unverified.

The new regression completes normal verification and email change, registers a second user at the released address, then replays the stale link without cookies. It is rejected, creates no authenticated session, and changes neither user's address. Upstream's patch binds links to user IDs, stops email-change-link auto-sign-in, and preserves verification only when the prior address was verified; consumers should not rely on the former auto-sign-in side effect.

Impact

Patches both advisory ranges while preserving existing sign-in/provider callback paths and account identities. No intended UI or database schema change. External-provider production smoke testing and effective deployed-config verification remain outstanding; the evidence below supports local compatibility, not a production exposure determination. Do not merge or enable auto-merge as part of this task.

How it was tested

  • Frozen workspace install passed; lockfile graph has exactly one aligned 1.7.25 auth bundle. All new resolutions pass unchanged release-age policy.
  • Final follow-up web server tests: 6 files / 71 passed (auth, OAuth, email change, real Next-cookie session renewal, auth context, allowlist).
  • Initial targeted client tests: 3 files / 31 passed (auth client, provider config, sign-in form); not rerun for the test-only follow-up.
  • Mutation sensitivity check: temporarily replaced installed 1.7.25 core claim normalization with raw-value passthrough. Exactly the three false-like string cases failed; boolean false and both true controls passed. Restored the library byte-for-byte before final passing tests, push and browser proof. This is a targeted mutation, not a full 1.7.12-graph test.
  • OAuth: actual Roomote auth factory + real Drizzle/PostgreSQL. A local HTTP GitLab fixture serves authorization redirects, single-use code exchange with redirect/client/grant checks and bearer-protected userinfo; the registered legacy callback returns a real session for the existing account without duplication. Provider configuration/admission are fixture-injected, not live operator credentials. Existing Slack/Microsoft and other-provider cases use controlled HTTP-fetch responses, including signed Microsoft ID tokens and rejection cases.
  • Browser rerun on the follow-up: real local Next.js/PostgreSQL, existing fixture account initially created via dev-login with password set through product UI, then real sign-out and normal email/password form sign-in to authenticated Personal settings. No UI/network mocks. New screenshots below. Historical initial-head recording shows submission of the already-filled form and navigation; it was captured at 084d593f0, not recaptured for this test-only follow-up.
  • Initial pnpm --filter @roomote/web build, web check-types:fast, and pnpm lint:fast passed. Follow-up web types and normal pre-commit/pre-push gates passed, including workspace fast types (27 tasks, 26 cached), residual lint and knip. Production build was not rerun for the test-only change. Initial build emitted filesystem-tracing/Sentry deprecation warnings; install reported the unrelated existing Daytona/AWS peer mismatch, and knip retained an informational docs configuration hint.
  • Not exercised: real Slack/Microsoft/GitLab/etc. credentials or remote provider consent, production auth/sender/config, actual delivered email, generic-JWKS/Zoom configurations absent from this source, non-Drizzle adapter runtime behavior, full repository tests or formatting-inclusive full static commands. Kysely and other bundled adapters were verified for version alignment, not runtime use by this application.

Download exact test/build/install/policy/pre-push logs.

Follow-up findings assessment and limits · Final tests, expected-failure mutation and push logs.

Screenshots

Real sandbox password form before submission; fixture password is masked.

Password sign-in

Authenticated Personal settings after that password sign-in. This is sandbox proof, not external OAuth or production proof.

Authenticated Personal settings

Checklist

  • The PR title follows the repo convention: [Fix], [Feat], [Improve], [Refactor], [Docs], or [Chore] followed by a user-facing description
  • This PR is small and scoped to one change
  • pnpm lint and pnpm check-types pass locally
    • Ran the repository-recommended fast lint/types gates and production build instead of formatting-inclusive full commands.
  • I added tests or included a clear manual validation note above
  • I removed secrets, tokens, private keys, and customer data from code, logs, and screenshots
  • If this change should appear in the changelog, I ran pnpm changeset
    • No changeset added; release-note selection remains with release preparation.

@roomote-community

roomote-community Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

No new code issues found. The prior finding is addressed: the fixture verifies the local account and includes successful boolean/string true controls. CI tests and JavaScript/TypeScript CodeQL analysis were still running when checked. See session

Reviewed bd8df46

@roomote-roomote

roomote-roomote Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed the sole valid finding in bd8df4663 on this same branch. No findings disputed. The local account is now explicitly verified before testing provider claims, with successful boolean/string true controls and a boolean-false negative control. A temporary raw-claim mutation made exactly the three false-like string cases fail; the dependency was restored before final validation.

71 auth/server tests passed, web fast types and normal pre-commit/pre-push gates passed, and genuine browser password sign-in was rerun. The Roomote code review check now passes, its summary reports no unresolved issues, and the review thread is resolved. Other CI tests were still running at the last check; no all-CI-green claim.

PR assessment now explicitly includes the default verified-local-email precondition and preserves both advisory condition tables and production-config uncertainty. Live external OAuth, actual email delivery and production exposure remain unverified. Initial production build/client test results are labeled as initial-run evidence; the follow-up changed only a test.

Assessment and evidence limits · Test/mutation/push logs. Refreshed sign-in screenshots are in the PR body. Draft status is explicitly held; no merge or auto-merge.

@daniel-lxs
daniel-lxs marked this pull request as ready for review November 22, 2026 17:20
@daniel-lxs
daniel-lxs merged commit a520f25 into develop Nov 22, 2026
34 checks passed
@daniel-lxs
daniel-lxs deleted the fix/better-auth-advisories-10juoosbwyk26 branch November 22, 2026 17:23
@roomote-roomote roomote-roomote Bot mentioned this pull request Nov 22, 2026
8 of 12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant