[PR #8047] [MERGED] v1.4.x #24610

Closed
opened 2026-04-15 22:28:09 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8047
Author: @himself65
Created: 2/18/2026
Status: Merged
Merged: 2/23/2026
Merged by: @himself65

Base: mainHead: v1.4.x-staging


📝 Commits (10+)

  • 38d1475 fix(stripe): clarify error when authorizeReference is missing (#7741)
  • de28893 fix(passkey): compute expirationTime per-request instead of at init (#7731)
  • 659e222 fix(passkey): use deleteVerificationByIdentifier for secondary-storage cleanup (#7790)
  • b0dbcbc fix(microsoft): add verifyIdToken support for Microsoft Entra ID provider (#7795)
  • 3736244 fix(sso): correct IdentityProvider configuration in signInSSO (#7708)
  • 9ccaf5c fix(sso): fix broken relay state redirect on SAML ACS route (#7781)
  • 95f2015 fix(sso): validate aud claim in OpenID Connect ID tokens (#7816)
  • 5bea3ae fix(sso): harden SAML ACS error redirects and add regression test for #7777 (#7815)
  • b965eaa fix(organization): remove unreachable null check in acceptInvitation (#7825)
  • 4736207 fix(custom-session): use getSetCookie() to preserve individual Set-Cookie headers (#7879)

📊 Changes

18 files changed (+1464 additions, -153 deletions)

View changed files

📝 packages/better-auth/src/plugins/custom-session/custom-session.test.ts (+109 -8)
📝 packages/better-auth/src/plugins/custom-session/index.ts (+15 -4)
📝 packages/better-auth/src/plugins/organization/organization.test.ts (+1 -2)
📝 packages/better-auth/src/plugins/organization/routes/crud-invites.ts (+0 -8)
📝 packages/better-auth/src/social.test.ts (+377 -0)
📝 packages/core/src/oauth2/validate-authorization-code.ts (+13 -26)
packages/core/src/oauth2/validate-token.test.ts (+241 -0)
📝 packages/core/src/social-providers/microsoft-entra-id.ts (+84 -1)
📝 packages/passkey/src/index.ts (+12 -8)
📝 packages/passkey/src/passkey.test.ts (+86 -2)
📝 packages/passkey/src/routes.ts (+10 -10)
📝 packages/sso/src/routes/sso.ts (+119 -78)
📝 packages/sso/src/saml.test.ts (+392 -0)
📝 packages/sso/src/types.ts (+1 -0)
📝 packages/stripe/src/error-codes.ts (+2 -0)
📝 packages/stripe/src/middleware.ts (+1 -1)
📝 packages/stripe/test/stripe-organization.test.ts (+1 -3)
📝 packages/stripe/test/stripe.test.ts (+0 -2)

📄 Description

Summary by cubic

Strengthens auth across sessions, SSO/SAML, passkeys, and Microsoft Entra ID with stricter token checks, tenant-aware issuer validation, and safer redirects. Also switches OAuth2 token verification to remote JWKS with audience/issuer enforcement and clarifies Stripe organization subscription errors.

  • New Features

    • Microsoft Entra ID: verifyIdToken with JWKS validation, audience checks, tenant-specific issuer, nonce support, and optional disableIdTokenSignIn.
    • OAuth2: validateToken uses remote JWKS (jose) with audience/issuer options; supports RS256/ES256/EdDSA.
    • SSO/SAML: signed AuthnRequests via authnRequestsSigned with SP private key support.
  • Bug Fixes

    • Sessions: preserve separate Set-Cookie headers and per-cookie Max-Age; avoid comma-joined headers when cookieCache is enabled.
    • SSO: fix IdentityProvider setup when idpMetadata lacks metadata; parse RelayState safely (verification ID on ACS), use trusted error/callback redirects; validate OIDC ID tokens via JWKS with audience/issuer.
    • Passkey: compute expiration per request (5-minute TTL) and clean up secondary storage via deleteVerificationByIdentifier; register plugin in BetterAuth.
    • Stripe: clearer error when authorizeReference is not configured (AUTHORIZE_REFERENCE_REQUIRED).
    • Organization: remove unreachable null check in acceptInvitation.

Written for commit 473620736e. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8047 **Author:** [@himself65](https://github.com/himself65) **Created:** 2/18/2026 **Status:** ✅ Merged **Merged:** 2/23/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `main` ← **Head:** `v1.4.x-staging` --- ### 📝 Commits (10+) - [`38d1475`](https://github.com/better-auth/better-auth/commit/38d14752a20c5efb2d41d88ab9d52c8285c06c10) fix(stripe): clarify error when authorizeReference is missing (#7741) - [`de28893`](https://github.com/better-auth/better-auth/commit/de28893a134feb9a5c680305440c9021ba33bf08) fix(passkey): compute expirationTime per-request instead of at init (#7731) - [`659e222`](https://github.com/better-auth/better-auth/commit/659e222bd7deb7dd7f6287c93b179204155b001b) fix(passkey): use `deleteVerificationByIdentifier` for secondary-storage cleanup (#7790) - [`b0dbcbc`](https://github.com/better-auth/better-auth/commit/b0dbcbcc61778d42b13fb08bdce7449fdc4a3bd1) fix(microsoft): add `verifyIdToken` support for Microsoft Entra ID provider (#7795) - [`3736244`](https://github.com/better-auth/better-auth/commit/373624433c7209e3a0dc0c7baf94955f8de2a092) fix(sso): correct IdentityProvider configuration in signInSSO (#7708) - [`9ccaf5c`](https://github.com/better-auth/better-auth/commit/9ccaf5c5e1b4f3164137ff99547695aa5194a4c7) fix(sso): fix broken relay state redirect on SAML ACS route (#7781) - [`95f2015`](https://github.com/better-auth/better-auth/commit/95f201568c7086073e55513cd4a9c0a9d664d90c) fix(sso): validate aud claim in OpenID Connect ID tokens (#7816) - [`5bea3ae`](https://github.com/better-auth/better-auth/commit/5bea3ae7cd1819e512b6de9d05f48afbafc0b8a2) fix(sso): harden SAML ACS error redirects and add regression test for #7777 (#7815) - [`b965eaa`](https://github.com/better-auth/better-auth/commit/b965eaa5d0ed8f91d6d4d0f7eb70f696386e9371) fix(organization): remove unreachable null check in `acceptInvitation` (#7825) - [`4736207`](https://github.com/better-auth/better-auth/commit/473620736e97ddb2548ef3659f2218c371ab31d1) fix(custom-session): use getSetCookie() to preserve individual Set-Cookie headers (#7879) ### 📊 Changes **18 files changed** (+1464 additions, -153 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/custom-session/custom-session.test.ts` (+109 -8) 📝 `packages/better-auth/src/plugins/custom-session/index.ts` (+15 -4) 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+1 -2) 📝 `packages/better-auth/src/plugins/organization/routes/crud-invites.ts` (+0 -8) 📝 `packages/better-auth/src/social.test.ts` (+377 -0) 📝 `packages/core/src/oauth2/validate-authorization-code.ts` (+13 -26) ➕ `packages/core/src/oauth2/validate-token.test.ts` (+241 -0) 📝 `packages/core/src/social-providers/microsoft-entra-id.ts` (+84 -1) 📝 `packages/passkey/src/index.ts` (+12 -8) 📝 `packages/passkey/src/passkey.test.ts` (+86 -2) 📝 `packages/passkey/src/routes.ts` (+10 -10) 📝 `packages/sso/src/routes/sso.ts` (+119 -78) 📝 `packages/sso/src/saml.test.ts` (+392 -0) 📝 `packages/sso/src/types.ts` (+1 -0) 📝 `packages/stripe/src/error-codes.ts` (+2 -0) 📝 `packages/stripe/src/middleware.ts` (+1 -1) 📝 `packages/stripe/test/stripe-organization.test.ts` (+1 -3) 📝 `packages/stripe/test/stripe.test.ts` (+0 -2) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Strengthens auth across sessions, SSO/SAML, passkeys, and Microsoft Entra ID with stricter token checks, tenant-aware issuer validation, and safer redirects. Also switches OAuth2 token verification to remote JWKS with audience/issuer enforcement and clarifies Stripe organization subscription errors. - **New Features** - Microsoft Entra ID: verifyIdToken with JWKS validation, audience checks, tenant-specific issuer, nonce support, and optional disableIdTokenSignIn. - OAuth2: validateToken uses remote JWKS (jose) with audience/issuer options; supports RS256/ES256/EdDSA. - SSO/SAML: signed AuthnRequests via authnRequestsSigned with SP private key support. - **Bug Fixes** - Sessions: preserve separate Set-Cookie headers and per-cookie Max-Age; avoid comma-joined headers when cookieCache is enabled. - SSO: fix IdentityProvider setup when idpMetadata lacks metadata; parse RelayState safely (verification ID on ACS), use trusted error/callback redirects; validate OIDC ID tokens via JWKS with audience/issuer. - Passkey: compute expiration per request (5-minute TTL) and clean up secondary storage via deleteVerificationByIdentifier; register plugin in BetterAuth. - Stripe: clearer error when authorizeReference is not configured (AUTHORIZE_REFERENCE_REQUIRED). - Organization: remove unreachable null check in acceptInvitation. <sup>Written for commit 473620736e97ddb2548ef3659f2218c371ab31d1. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 22:28:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#24610