[PR #6805] [MERGED] feat(saml): add XML parser hardening with configurable size limits #6894

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6805
Author: @Paola3stefania
Created: 12/16/2025
Status: Merged
Merged: 12/24/2025
Merged by: @himself65

Base: canaryHead: feat/saml-xml-parser-hardening


📝 Commits (10+)

📊 Changes

7 files changed (+115 additions, -5 deletions)

View changed files

📝 docs/content/docs/plugins/sso.mdx (+34 -0)
📝 packages/sso/src/constants.ts (+16 -0)
📝 packages/sso/src/index.ts (+6 -0)
📝 packages/sso/src/routes/sso.ts (+33 -0)
📝 packages/sso/src/saml.test.ts (+13 -5)
📝 packages/sso/src/saml/algorithms.ts (+1 -0)
📝 packages/sso/src/types.ts (+12 -0)

📄 Description

Summary by cubic

Hardened SAML handling by adding size limits and disabling XML entity processing. This blocks oversized payloads and XXE-style attacks, with configurable limits.

  • Security Hardening

    • Reject SAML responses larger than 256KB (ACS and callback).
    • Reject IdP metadata larger than 100KB during provider setup.
    • Disable XML entity processing (processEntities: false) in the XML parser.
  • New Features

    • Config options: saml.maxResponseSize (default 256KB) and saml.maxMetadataSize (default 100KB).
    • Exported default size limit constants for reuse.

Written for commit 9cb51a87a6. 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/6805 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 12/16/2025 **Status:** ✅ Merged **Merged:** 12/24/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/saml-xml-parser-hardening` --- ### 📝 Commits (10+) - [`5fd0f72`](https://github.com/better-auth/better-auth/commit/5fd0f72e1636fecf45416d72eb424d48798e79b3) feat: add options adn constant - [`2dda974`](https://github.com/better-auth/better-auth/commit/2dda97493b945394b2c77322ad003d670ca77528) feat: check lenght - [`dc575eb`](https://github.com/better-auth/better-auth/commit/dc575ebad4f68cfb296e213b7e698b1b542ba8b5) add metadata validation - [`4ba5880`](https://github.com/better-auth/better-auth/commit/4ba5880dd8252b5074739bb203ca243ae9cfdaad) processEntities: false - [`b20fa12`](https://github.com/better-auth/better-auth/commit/b20fa12d9231451d51e88f9ecd731f3221ba73f2) feat: test - [`7216491`](https://github.com/better-auth/better-auth/commit/721649148e3ca0071ff355f5de013fa6ef024846) feat: docu and exports - [`40c3b71`](https://github.com/better-auth/better-auth/commit/40c3b717439ea94d00bf72f1a6d6a048fb83b7f4) fix doc - [`8a8d5f1`](https://github.com/better-auth/better-auth/commit/8a8d5f19b09696f4ca45696a642ca5fe5a578848) fix: use buffer for byte size check - [`35490a4`](https://github.com/better-auth/better-auth/commit/35490a4f434329e6607855178e7262c7f712a116) Merge branch 'canary' into feat/saml-xml-parser-hardening - [`af3d056`](https://github.com/better-auth/better-auth/commit/af3d05696d3eaf6a3628334f9859369e20c892b2) make lint happy ### 📊 Changes **7 files changed** (+115 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/sso.mdx` (+34 -0) 📝 `packages/sso/src/constants.ts` (+16 -0) 📝 `packages/sso/src/index.ts` (+6 -0) 📝 `packages/sso/src/routes/sso.ts` (+33 -0) 📝 `packages/sso/src/saml.test.ts` (+13 -5) 📝 `packages/sso/src/saml/algorithms.ts` (+1 -0) 📝 `packages/sso/src/types.ts` (+12 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Hardened SAML handling by adding size limits and disabling XML entity processing. This blocks oversized payloads and XXE-style attacks, with configurable limits. - **Security Hardening** - Reject SAML responses larger than 256KB (ACS and callback). - Reject IdP metadata larger than 100KB during provider setup. - Disable XML entity processing (processEntities: false) in the XML parser. - **New Features** - Config options: saml.maxResponseSize (default 256KB) and saml.maxMetadataSize (default 100KB). - Exported default size limit constants for reuse. <sup>Written for commit 9cb51a87a6a4d0149227681eb93423f994bcf489. 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:16:05 -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#6894