[PR #5033] [MERGED] fix(sso): prevent duplicate SSO provider creation with same providerId #31330

Closed
opened 2026-04-17 22:12:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5033
Author: @xiaoyu2er
Created: 10/2/2025
Status: Merged
Merged: 10/2/2025
Merged by: @himself65

Base: canaryHead: fix/sso-provider-duplicate-check


📝 Commits (1)

  • cdd185c fix(sso): prevent duplicate SSO provider creation with same providerId

📊 Changes

3 files changed (+106 additions, -0 deletions)

View changed files

📝 packages/sso/src/index.ts (+20 -0)
📝 packages/sso/src/oidc.test.ts (+37 -0)
📝 packages/sso/src/saml.test.ts (+49 -0)

📄 Description

  • Add validation check before creating SSO provider to ensure providerId is unique
  • Throw UNPROCESSABLE_ENTITY error if provider with same providerId already exists
  • Add tests for duplicate providerId validation in both SAML and OIDC flows

Summary by cubic

Prevent duplicate SSO provider creation by enforcing a unique providerId for both OIDC and SAML.

  • Bug Fixes
    • Validate providerId uniqueness before creating a provider.
    • If a duplicate is found, throw UNPROCESSABLE_ENTITY with message: "SSO provider with this providerId already exists".
    • Add tests covering duplicate creation for OIDC and SAML flows.

🔄 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/5033 **Author:** [@xiaoyu2er](https://github.com/xiaoyu2er) **Created:** 10/2/2025 **Status:** ✅ Merged **Merged:** 10/2/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/sso-provider-duplicate-check` --- ### 📝 Commits (1) - [`cdd185c`](https://github.com/better-auth/better-auth/commit/cdd185cb203e841c1b71a0e1130ce15e6f431988) fix(sso): prevent duplicate SSO provider creation with same providerId ### 📊 Changes **3 files changed** (+106 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/sso/src/index.ts` (+20 -0) 📝 `packages/sso/src/oidc.test.ts` (+37 -0) 📝 `packages/sso/src/saml.test.ts` (+49 -0) </details> ### 📄 Description - Add validation check before creating SSO provider to ensure providerId is unique - Throw UNPROCESSABLE_ENTITY error if provider with same providerId already exists - Add tests for duplicate providerId validation in both SAML and OIDC flows <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Prevent duplicate SSO provider creation by enforcing a unique providerId for both OIDC and SAML. - **Bug Fixes** - Validate providerId uniqueness before creating a provider. - If a duplicate is found, throw UNPROCESSABLE_ENTITY with message: "SSO provider with this providerId already exists". - Add tests covering duplicate creation for OIDC and SAML flows. <!-- 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-17 22:12:39 -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#31330