[PR #6653] [CLOSED] fix(sso): ensure requestSignup is respected for SAML #6805

Closed
opened 2026-03-13 13:12:19 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6653
Author: @jonathansamines
Created: 12/10/2025
Status: Closed

Base: canaryHead: chore/sso-relay-state


📝 Commits (8)

  • a4acc36 chore: add relay persistance support
  • c11b6f9 chore(sso): respect requestSignup flag
  • 777300e chore(better-auth): restore verification schema validation
  • 54c646a Merge branch 'canary' into chore/sso-relay-state
  • 60c3f31 chore(sso): update tests to match new strict relay state verification
  • e6b870e Merge branch 'canary' into chore/sso-relay-state
  • 5e2045f Merge branch 'canary' into chore/sso-relay-state
  • 323fb5f Merge branch 'canary' into chore/sso-relay-state

📊 Changes

6 files changed (+575 additions, -179 deletions)

View changed files

📝 packages/better-auth/src/oauth2/state.ts (+20 -163)
packages/better-auth/src/state.ts (+231 -0)
📝 packages/better-auth/src/utils/index.ts (+2 -0)
📝 packages/sso/src/routes/sso.ts (+30 -10)
packages/sso/src/saml-state.ts (+78 -0)
📝 packages/sso/src/saml.test.ts (+214 -6)

📄 Description

Summary by cubic

Adds secure RelayState persistence to SAML flows and ensures requestSignUp is honored even when implicit signup is disabled. Introduces a unified state module used by OAuth2 and SAML for consistent state handling and clearer errors.

  • New Features

    • Added generateRelayState/parseRelayState for SAML; stores callbackURL and requestSignUp and validates on callback.
    • Unified state helpers (generateGenericState/parseGenericState) exported from better-auth for cookie/DB strategies.
    • SAML callback now uses RelayState’s callbackURL for redirects.
  • Bug Fixes

    • Respects requestSignUp in SAML when disableImplicitSignUp is true, allowing explicit signup.
    • Rejects invalid/mismatched RelayState with BAD_REQUEST to prevent unintended account creation or insecure redirects.

Written for commit 323fb5fd6a. Summary will update automatically 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/6653 **Author:** [@jonathansamines](https://github.com/jonathansamines) **Created:** 12/10/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `chore/sso-relay-state` --- ### 📝 Commits (8) - [`a4acc36`](https://github.com/better-auth/better-auth/commit/a4acc36c4acaa3d1df1c769eb8143a5f40af0ade) chore: add relay persistance support - [`c11b6f9`](https://github.com/better-auth/better-auth/commit/c11b6f9fdbc63cd62cb7f0ecf5c7c4dab8419a8a) chore(sso): respect requestSignup flag - [`777300e`](https://github.com/better-auth/better-auth/commit/777300e5f038a561af7cf699ee73bf2ebef5c881) chore(better-auth): restore verification schema validation - [`54c646a`](https://github.com/better-auth/better-auth/commit/54c646a6812bd2a68f53542f0059a2a64eb1273b) Merge branch 'canary' into chore/sso-relay-state - [`60c3f31`](https://github.com/better-auth/better-auth/commit/60c3f311b91c0a8e8f8cba21cf091da0a3ae5c46) chore(sso): update tests to match new strict relay state verification - [`e6b870e`](https://github.com/better-auth/better-auth/commit/e6b870e572e48cab80c436343012cffc66463e49) Merge branch 'canary' into chore/sso-relay-state - [`5e2045f`](https://github.com/better-auth/better-auth/commit/5e2045fdd95ee45be43adf4417c54c480dedb2a2) Merge branch 'canary' into chore/sso-relay-state - [`323fb5f`](https://github.com/better-auth/better-auth/commit/323fb5fd6a3b895f0ec1e80d8e7a93acf1b71d6b) Merge branch 'canary' into chore/sso-relay-state ### 📊 Changes **6 files changed** (+575 additions, -179 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/oauth2/state.ts` (+20 -163) ➕ `packages/better-auth/src/state.ts` (+231 -0) 📝 `packages/better-auth/src/utils/index.ts` (+2 -0) 📝 `packages/sso/src/routes/sso.ts` (+30 -10) ➕ `packages/sso/src/saml-state.ts` (+78 -0) 📝 `packages/sso/src/saml.test.ts` (+214 -6) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds secure RelayState persistence to SAML flows and ensures requestSignUp is honored even when implicit signup is disabled. Introduces a unified state module used by OAuth2 and SAML for consistent state handling and clearer errors. - **New Features** - Added generateRelayState/parseRelayState for SAML; stores callbackURL and requestSignUp and validates on callback. - Unified state helpers (generateGenericState/parseGenericState) exported from better-auth for cookie/DB strategies. - SAML callback now uses RelayState’s callbackURL for redirects. - **Bug Fixes** - Respects requestSignUp in SAML when disableImplicitSignUp is true, allowing explicit signup. - Rejects invalid/mismatched RelayState with BAD_REQUEST to prevent unintended account creation or insecure redirects. <sup>Written for commit 323fb5fd6a3b895f0ec1e80d8e7a93acf1b71d6b. Summary will update automatically 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-03-13 13:12:19 -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#6805