Commit Graph
171 Commits
Author SHA1 Message Date
better-release[bot]andGitHub 8b1e759c07 chore: release v1.7.0-beta.5 (#9905) 2026-06-10 12:34:04 -07:00
Gustavo Valverde bf7f2c5b4e chore: sync main to next 2026-06-10 11:30:38 -07:00
better-release[bot]andGitHub 1a3c8c478a chore: release v1.6.16 (#9958) 2026-06-09 22:32:25 -07:00
Bereket EngidaandGitHub cb1cbfa4cc fix: address bug findings across packages (#9974) 2026-06-09 19:46:12 -07:00
Gustavo ValverdeandGitHub 0e1770ac75 feat(oauth-provider)!: enforce max_age (#9936) 2026-06-09 19:36:30 -07:00
Gustavo ValverdeandGitHub 76a33429fc fix(session): fire session-delete hooks for preserved sessions on secondaryStorage (#9969) 2026-06-10 00:40:56 +00:00
Gustavo ValverdeandGitHub 3e852a2650 fix(oauth-provider): report unsupported_token_type for JWT access-token revocation (#9970) 2026-06-10 00:39:26 +00:00
Gustavo ValverdeandGitHub 7abaaed53f fix(oauth-provider): make private_key_jwt jti single-use atomic across processes (#9964) 2026-06-10 00:36:06 +00:00
better-release[bot]andGitHub 03e0e36a98 chore: release v1.6.15 (#9886) 2026-06-08 06:57:06 -07:00
Gustavo ValverdeandGitHub fe9600bc07 feat(oauth-provider): accept POST on the userinfo endpoint (#9937) 2026-06-07 21:09:27 -07:00
0cbaf81bed feat(oauth): server-trusted state channel; fix anonymous cookieless linking (#9930)
Co-authored-by: Taesu <166604494+bytaesu@users.noreply.github.com>
2026-06-08 01:00:05 +00:00
b0ddfd3433 fix(oauth-provider): run configured hooks when authorize resumes (#9919)
Co-authored-by: Gautam Manchandani <manchandanigautam@gmail.com>
2026-06-07 14:43:47 -07:00
Gustavo ValverdeandGitHub e0d2b9eb9b feat(oauth-provider)!: add OIDC back-channel logout (#9304) 2026-06-06 07:06:53 -07:00
Gustavo ValverdeandGitHub 40b392ae21 feat(oauth)!: accumulate granted scopes as grantedScopes string[] (#9825) 2026-06-04 17:54:52 -04:00
better-release[bot]andGitHub 5038d41ca2 chore: release v1.6.14 (#9846) 2026-06-02 16:56:28 -04:00
better-release[bot]andGitHub a5e2442e3c chore: release v1.7.0-beta.4 (#9534) 2026-05-31 14:29:39 +01:00
Gustavo ValverdeandGitHub b4b086722c fix(oauth-provider)!: bind RFC 8707 resource indicators to the authorization grant (#9836) 2026-05-31 14:14:50 +01:00
Gustavo Valverde 065f5ad72d chore: sync main to next
Brings the v1.6.13 stable fixes into next: redirect_uri scheme validation in oidc-provider and mcp (#9838), clientPrivileges enforcement on dynamic client registration (#9837), null organization logo support (#9842), the consumeOne non-numeric deleteMany guard (#9831), and the db-adapter guide alignment (#9830).

Conflicts were limited to release version bumps and CHANGELOG entries; resolved by keeping next's 1.7.0-beta.3 line. The ten changesets consumed by the v1.6.13 release are accepted as deleted, and no external dependencies changed.
2026-05-31 13:02:15 +01:00
better-release[bot]andGitHub a6f38c72ee chore: release v1.6.13 (#9804) 2026-05-31 12:41:17 +01:00
Gustavo ValverdeandGitHub 17ab66c3a4 fix(oauth-provider): enforce clientPrivileges on dynamic client registration (#9837) 2026-05-31 11:02:27 +00:00
Gustavo ValverdeandGitHub be32012ca3 fix(oauth): validate redirect_uri schemes in oidc-provider and mcp (#9838) 2026-05-31 11:38:52 +01:00
Gustavo Valverde 0fe3590e16 test(oauth-provider): adapt merged token/private-key-jwt tests to next's APIs (#9533)
These test files auto-merged main's additions onto next's refactored test
surface, producing runtime failures tsc could not catch:

- token.test.ts called main's sync createRefreshAccessTokenRequest, which next
  renamed to the async refreshAccessTokenRequest; the calls now await it and
  the concurrent-rotation helper is async.
- private-key-jwt-e2e.test.ts hit the merged-in #9578 gate: both the provider
  and RP test instances create the same default user, so the OAuth sign-in
  links to the RP's unverified local user and is blocked. The RP sets
  requireLocalEmailVerified: false so the test exercises private_key_jwt
  rather than the (separately covered) email-verification gate.
- utils/basic-auth.test.ts is removed: next made basicToClientCredentials
  private, and its colon-preservation coverage now lives in core's
  basic-credentials.test.ts.

Full oauth-provider suite green (24 files, 378 tests).
2026-05-31 01:51:34 +01:00
Gustavo Valverde 8bfd30f10a style: apply biome formatting to synced files (#9533) 2026-05-31 01:30:41 +01:00
Gustavo Valverde 027a10c566 fix(oauth-provider): gate DCR and serve path-prefixed issuer metadata (#9448, #9668)
Re-applies two main fixes onto next's refactored metadata layer.

- #9448: registration_endpoint is now advertised only when dynamic client
  registration is enabled. With DCR off, the field was still advertised in
  authorization-server and OpenID metadata while the endpoint itself was
  disabled, so clients attempted a registration that failed.
- #9668: the authorization-server and OpenID discovery documents are served
  again at their path-prefixed (RFC 8414 path-insertion and issuer-appended)
  aliases via an onRequest handler, with HEAD support and a 405 for
  non-GET/HEAD. next's refactor kept the server-only metadata endpoints but
  dropped the request handler that exposes them over HTTP. The handler is
  adapted to next's metadata (CIMD-aware public-client flag and merged
  discovery metadata) and metadataResponse is exported for it.

#9601 (preserve colons in Basic Auth secret) is already covered: next routes
Basic parsing through @better-auth/core decodeBasicCredentials, which splits
on the first colon, so no change to utils/index.ts.

The merged metadata test suite (union of next and main, including the
DCR-conditional and alias cases) passes.

(cherry picked from commit 66a7b0b62d76e36474ebdca189f59200daa3ec76)
2026-05-31 00:10:36 +01:00
Gustavo Valverde ef4fb0ff95 chore: merge main into next (#9533)
Sync main (through #9821/#9820/#9822/#9768) into next. Conflicting
package.json files keep next's version and intentional divergences (for
example the cli's c12 v4) while taking main's dependency updates, including
the samlify 2.13.1 and fast-xml-parser security bumps; the lockfile is
regenerated from the reconciled set. The 13 source/doc/test conflicts take
next's refactored architecture as the baseline; main's colliding fixes are
re-applied on top in the following per-domain commits.

Clean main fixes land via this merge, including the auto-restored
account-takeover defenses #9578 and #9577.
2026-05-31 00:10:16 +01:00
better-release[bot]andGitHub c0c574ea50 chore: release v1.6.12 (#9590) 2026-05-29 22:28:58 +01:00
d64174ec86 fix(oauth-provider): hide DCR endpoint unless enabled (#9448)
Co-authored-by: Gustavo Valverde <g.valverde02@gmail.com>
2026-05-27 13:18:16 +00:00
8401d11f43 fix(oauth-provider): serve path-prefixed issuer metadata aliases (#9668)
Co-authored-by: Gustavo Valverde <g.valverde02@gmail.com>
2026-05-27 12:38:27 +00:00
f77060af3a fix: consumeVerificationValue returns null for expired rows (#9624)
Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
2026-05-19 16:37:55 +00:00
Gustavo ValverdeandGitHub 1e5b808472 refactor(oauth): single-source Basic credentials + getHttpTestInstance (#9657) 2026-05-17 19:23:45 +00:00
aebf66d8e6 feat: add token endpoint client authentication (#9625)
Co-authored-by: Gustavo Valverde <g.valverde02@gmail.com>
2026-05-16 18:27:15 +00:00
TaesuandGitHub 938efee305 fix(oauth-provider): preserve colons in Basic Auth client secret (#9601) 2026-05-15 15:48:59 +00:00
TaesuandGitHub 87f5a8fd27 fix(oauth-provider): return NOT_FOUND when consent update references a missing client (#9600) 2026-05-15 15:48:25 +00:00
better-release[bot]andGitHub f41514ef07 chore: release v1.6.11 (#9532) 2026-05-12 17:30:34 +01:00
b4bc65a007 Merge commit from fork
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>
2026-05-12 16:53:45 +01:00
c6918ecc9e Merge commit from fork
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>
2026-05-12 16:36:32 +01:00
Gustavo ValverdeandGitHub da7e50beee fix(oauth): block OAuth linking to unverified local accounts (#9578) 2026-05-12 14:20:19 +00:00
better-release[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
4839a2d761 chore: release v1.7.0-beta.3 (#9323)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-05-09 19:28:11 +00:00
Taesu 2b83087180 chore: sync main to next 2026-05-10 03:45:29 +09:00
better-release[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
cbb5014cdf chore: release v1.6.10 (#9350)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-05-09 14:31:47 +00:00
f7bc1c7349 fix(oauth-provider): index OAuth foreign keys (#9389)
Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
2026-05-06 05:22:28 +00:00
d427d1dba9 fix(oauth-provider): export declaration helper types (#9406)
Co-authored-by: cyphercodes <7407177+cyphercodes@users.noreply.github.com>
Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
2026-05-06 05:20:44 +00:00
6b03a45a14 chore(oauth-provider): correct optional typing for refreshToken sessionId field (#9324)
Co-authored-by: Taesu <bytaesu@gmail.com>
2026-05-03 19:12:23 +00:00
Gustavo ValverdeandGitHub 408a3076bd fix(oauth-provider): honor prompt=login across consent continuation (#9344) 2026-04-27 08:49:55 +00:00
better-release[bot]andGitHub f484269228 chore: release v1.6.9 (#9341) 2026-04-24 06:25:08 +01:00
better-release[bot]andGitHub b289ac6c4b chore: release v1.6.8 (#9316) 2026-04-23 11:31:03 +01:00
Gustavo ValverdeandGitHub 8e3cc3453c fix(oauth-provider): accept authorization flows without state (#9328) 2026-04-23 07:00:05 +00:00
better-release[bot]andGitHub d3bde2d21f chore: release v1.7.0-beta.2 (#9207) 2026-04-22 17:23:06 +01:00
Gustavo Valverde eb3cd10d50 chore: resolve main-to-next sync conflicts
- keep next package versions at 1.7.0-beta.1
- keep both changelog streams by inserting the stable 1.6.5, 1.6.6, and 1.6.7 sections below the 1.7.0-beta entries
- keep the cimd and dash deps on demo/nextjs (next-only); regenerate pnpm-lock.yaml
- resolve TODO(sync-from-main-9226) in oauth-provider authorize.ts: findRegisteredRedirectUri now uses isLoopbackIP from @better-auth/core/utils/host to cover the full 127.0.0.0/8 range per RFC 8252 §7.3
- drop the unused saml import that main's #9262 added to sso/src/routes/sso.ts; next already migrated to saml-pipeline
2026-04-22 14:54:27 +01:00
better-release[bot]andGitHub f8076d141a chore: release v1.6.7 (#9289) 2026-04-22 12:36:30 +01:00