Skip to content

chore: sync upstream v1.6.11 + bump @btst to v2.3.0#43

Draft
cursor[bot] wants to merge 188 commits into
mainfrom
cursor/upstream-fork-sync-a3f2
Draft

chore: sync upstream v1.6.11 + bump @btst to v2.3.0#43
cursor[bot] wants to merge 188 commits into
mainfrom
cursor/upstream-fork-sync-a3f2

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented May 15, 2026

Summary

Syncs our fork with upstream better-auth tag v1.6.11 (from v1.6.2 → v1.6.11), vendors updated adapter files into @btst/* packages, and bumps all @btst/* versions to v2.3.0.

Upstream changes (v1.6.3–v1.6.11)

Key changes included in this sync:

  • feat(db): New consumeOne atomic adapter primitive (formerly claimOne, renamed in v1.6.11) — new adapter API surface → minor bump
  • fix(drizzle/kysely/prisma/memory/mongo): Various adapter fixes across all vendored adapters
  • fix(oauth): Block OAuth linking to unverified local accounts
  • fix(magic-link): Consume verification token atomically on verify
  • fix(organization): Default-on requireEmailVerificationOnInvitation
  • fix(sso): Validate user-supplied OIDC endpoint URLs; require org admin role
  • fix(access): Preserve exact role statement types
  • chore(ci): Added fallback ubuntu-24.04 runner for fork CI (replaces need for manual runner substitution)
  • Various security fixes and plugin improvements

What changed in @btst

  • All 5 adapter source files updated via sync-upstream.ts (drizzle, prisma, memory, mongodb, kysely + supporting files)
  • CLI generators/utils synced (no structural changes)
  • scripts/sync-upstream.ts HEADER_COMMENT fixed (trailing whitespace causing Biome lint failures)
  • .cspell/custom-words.txt fixed (corrupted CIBAbtst entry split back to CIBA + btst/BTST)

Version bump

2.2.12.3.0 (minor bump — new consumeOne adapter primitive is meaningful new functionality)

Peer dependency constraints unchanged (>=1.6.0 still valid).

CI checks passed locally

  • pnpm lint (Biome)
  • pnpm lint:dependencies (knip)
  • pnpm lint:packages
  • pnpm lint:spell (cspell)
  • pnpm format:check
  • pnpm lint:types
  • pnpm --filter "@btst/*" exec tsc --noEmit
  • @btst/db tests (28 passed)
  • @btst/adapter-memory tests (11 passed)
  • @btst/cli schema-conversion tests (7 passed)
  • @btst/cli generate-all-orms tests (20 passed, no snapshot changes)
  • ⏭️ @btst/cli e2e-cli tests (expected CI-only failure — needs live Postgres + MySQL)

Post-merge release

After merging, tag and release:

git checkout main && git pull
git tag btst-v2.3.0
git push origin btst-v2.3.0
# Then create GitHub Release from that tag
Open in Web View Automation 

gustavovalverde and others added 30 commits April 9, 2026 18:15
Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
…ter-auth#9072)

Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
…r-auth#8389)

Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
Co-authored-by: ping-maxwell <maxwell.multinite@gmail.com>
Co-authored-by: leonardo2204 <1509421+leonardo2204@users.noreply.github.com>
Co-authored-by: better-release[bot] <273320539+better-release[bot]@users.noreply.github.com>
…gin (better-auth#8982)

Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
Co-authored-by: Taesu <bytaesu@gmail.com>
Co-authored-by: Taesu <166604494+bytaesu@users.noreply.github.com>
better-auth#8926)

Co-authored-by: better-release[bot] <273320539+better-release[bot]@users.noreply.github.com>
…lidation

grep -coP outputs "0" to stdout on no matches but exits 1, causing
the || echo 0 fallback to append a second "0". The resulting "0\n0"
value fails the -lt integer comparison. Use || true instead since
grep -c already outputs the correct count.
…on (better-auth#7231)

Co-authored-by: Gustavo Valverde <g.valverde02@gmail.com>
…h#9109)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Taesu <bytaesu@gmail.com>
Co-authored-by: Taesu <166604494+bytaesu@users.noreply.github.com>
dipan-ck and others added 30 commits May 11, 2026 10:58
…etter-auth#9548)

Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
…th#9220)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Gustavo Valverde <g.valverde02@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Gustavo Valverde <g.valverde02@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Taesu <bytaesu@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Taesu <166604494+bytaesu@users.noreply.github.com>
…nd update (better-auth#9574)

Co-authored-by: vaadata-poyetont <poyetont@vaadata.com>
Signed-off-by: Gautam Manchandani <manchandanigautam@gmail.com>
The `authorization_code`-grant rotation in `createRefreshToken` and the explicit `revokeRefreshToken` path both updated the parent `oauthRefreshToken` row using an `id`-only predicate, so two concurrent rotations (or a rotation racing a revoke) both pass the `revoked` check and last-write-wins. Each surviving request mints a fresh refresh token, producing a forked family from one parent.

Both call sites now perform a compare-and-swap (`UPDATE ... WHERE id = ? AND revoked IS NULL`) and short-circuit with `invalid_grant` when the row was already consumed. The parent stays marked revoked, so any subsequent replay trips the existing family-invalidation guard in `handleRefreshTokenGrant`. The shared family-delete is centralized in `invalidateRefreshFamily`, which clears child access tokens before refresh rows to honor the schema's foreign-key direction; the `oauthRefreshToken.token` column also gains a `unique` constraint for parity with `oauthAccessToken.token`. Strict family invalidation on contested rotations (RFC 9700 §4.14) is tracked in a FIXME for a follow-up minor that opts into transactional rotation in the adapter contract.

Closes GHSA-392p-2q2v-4372.

Co-authored-by: chdanielmueller <4051999+chdanielmueller@users.noreply.github.com>
The `authorization_code` grant's verification step was a `findOne` + `deleteOne` pair, so two concurrent `POST /oauth2/token` requests sharing the same `code` both pass the find, both delete, and both mint independent access/refresh/id token sets: a CAS gap that lets an authorization code be redeemed twice. The legacy `oidc-provider` and `mcp` plugins in `better-auth` share the same primitive on their `authorization_code` paths and have the same gap.

All three call sites now use `internalAdapter.consumeVerificationValue` (the atomic primitive added in better-auth#9560 and renamed in better-auth#9568): the first concurrent caller receives the row and mints tokens, subsequent racers receive `null`. The consumed and expired paths return RFC 6749 §5.2 `invalid_grant` instead of the better-auth-internal `invalid_verification`, so spec-compliant clients can branch on the standard code. The redundant second `deleteVerificationByIdentifier` call after PKCE validation in the legacy paths is removed.

Closes GHSA-7w99-5wm4-3g79.

Co-authored-by: chdanielmueller <4051999+chdanielmueller@users.noreply.github.com>
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.