[PR #4848] [CLOSED] fix(sso):safe parsing of JSON for different database/adapater storage #31213

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4848
Author: @natetewelde
Created: 9/23/2025
Status: Closed

Base: canaryHead: fix/sso-safe-json-parse-of-saml-oidc-configs


📝 Commits (2)

  • 7830fd1 fix(sso):safe parsing of JSON for different database/adapater storage cases
  • ace8b11 fix: cubic ai suggestions

📊 Changes

1 file changed (+144 additions, -29 deletions)

View changed files

📝 packages/sso/src/index.ts (+144 -29)

📄 Description

Summary by cubic

Safely parse OIDC and SAML configs from different storage formats (string or object) and add stricter validation and discovery to prevent crashes and misconfiguration. Hardens SSO flows and improves SAML attribute mapping.

  • Bug Fixes

    • Replace JSON.parse with safe parsing helpers for OIDC/SAML configs.
    • Validate SAML config; return BAD_REQUEST if idpMetadata or spMetadata is missing.
    • Support OIDC discovery when endpoints aren’t set; clear error if authorization endpoint remains unset.
    • More robust SAML attribute extraction with fallbacks; optional emailVerified mapping.
  • Refactors

    • Add safeParseJSON helpers used across SSO endpoints.
    • Update SAMLConfig schema to include idp/sp metadata, encryption keys, algorithms, cert, and callbackUrl.
    • Standardize config parsing in provider read/return paths.

🔄 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/4848 **Author:** [@natetewelde](https://github.com/natetewelde) **Created:** 9/23/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/sso-safe-json-parse-of-saml-oidc-configs` --- ### 📝 Commits (2) - [`7830fd1`](https://github.com/better-auth/better-auth/commit/7830fd16dcf168b083172255e4479d011d1edf45) fix(sso):safe parsing of JSON for different database/adapater storage cases - [`ace8b11`](https://github.com/better-auth/better-auth/commit/ace8b1147d66d8c890266bddb4271c15ee1480cf) fix: cubic ai suggestions ### 📊 Changes **1 file changed** (+144 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `packages/sso/src/index.ts` (+144 -29) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Safely parse OIDC and SAML configs from different storage formats (string or object) and add stricter validation and discovery to prevent crashes and misconfiguration. Hardens SSO flows and improves SAML attribute mapping. - **Bug Fixes** - Replace JSON.parse with safe parsing helpers for OIDC/SAML configs. - Validate SAML config; return BAD_REQUEST if idpMetadata or spMetadata is missing. - Support OIDC discovery when endpoints aren’t set; clear error if authorization endpoint remains unset. - More robust SAML attribute extraction with fallbacks; optional emailVerified mapping. - **Refactors** - Add safeParseJSON helpers used across SSO endpoints. - Update SAMLConfig schema to include idp/sp metadata, encryption keys, algorithms, cert, and callbackUrl. - Standardize config parsing in provider read/return paths. <!-- 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:07:15 -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#31213