[PR #6706] [MERGED] feat(saml): assertion timestamp validation with per-provider clock skew #6840

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6706
Author: @Paola3stefania
Created: 12/12/2025
Status: Merged
Merged: 12/12/2025
Merged by: @Bekacru

Base: canaryHead: feat/saml-timestamp-validation


📝 Commits (8)

📊 Changes

5 files changed (+473 additions, -2 deletions)

View changed files

📝 docs/content/docs/plugins/sso.mdx (+94 -1)
📝 packages/sso/src/index.ts (+8 -0)
📝 packages/sso/src/routes/sso.ts (+103 -0)
📝 packages/sso/src/saml.test.ts (+236 -1)
📝 packages/sso/src/types.ts (+32 -0)

📄 Description

Summary by cubic

Add SAML assertion timestamp validation with configurable clock skew. Prevents accepting expired or future-dated assertions and allows stricter enforcement when needed.

  • New Features

    • Validate NotBefore and NotOnOrAfter with a default 5-minute clock skew; configurable via SSOOptions.saml.clockSkew.
    • Optional SSOOptions.saml.requireTimestamps to reject assertions missing conditions; otherwise logs a warning.
    • Applied in both SAML callback and ACS endpoints.
  • Bug Fixes

    • Reject expired AuthnRequest records when read from storage, even if cleanup hasn’t run yet.

Written for commit 514cb02a14. 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/6706 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 12/12/2025 **Status:** ✅ Merged **Merged:** 12/12/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/saml-timestamp-validation` --- ### 📝 Commits (8) - [`1f22196`](https://github.com/better-auth/better-auth/commit/1f2219657ef1ddb4fe1ba524d20779fe1634724b) feat: implement timestamp saml - [`600be78`](https://github.com/better-auth/better-auth/commit/600be787b1619a9c0a60222e614245e0f4a9cff4) make lint happy - [`80dce61`](https://github.com/better-auth/better-auth/commit/80dce611bf1231e978c49b022c06ad5100f48325) feat: docu - [`1c2f71d`](https://github.com/better-auth/better-auth/commit/1c2f71dcb832d0356b7a5fb3463da71599b91345) fix: test and validation - [`28261f6`](https://github.com/better-auth/better-auth/commit/28261f6ee450465617257730903cff358aa44a3f) fix: cleanup - [`134d945`](https://github.com/better-auth/better-auth/commit/134d94510d7dbc731de5fb2fc398980e3fef0495) cleanup - [`5bf3440`](https://github.com/better-auth/better-auth/commit/5bf3440971c9b4e052693bbf14a77ea45edc5aee) make lint happy - [`514cb02`](https://github.com/better-auth/better-auth/commit/514cb02a149e3acecc89725942509d705adddff4) fix: imports and add doca ### 📊 Changes **5 files changed** (+473 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/sso.mdx` (+94 -1) 📝 `packages/sso/src/index.ts` (+8 -0) 📝 `packages/sso/src/routes/sso.ts` (+103 -0) 📝 `packages/sso/src/saml.test.ts` (+236 -1) 📝 `packages/sso/src/types.ts` (+32 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Add SAML assertion timestamp validation with configurable clock skew. Prevents accepting expired or future-dated assertions and allows stricter enforcement when needed. - **New Features** - Validate NotBefore and NotOnOrAfter with a default 5-minute clock skew; configurable via SSOOptions.saml.clockSkew. - Optional SSOOptions.saml.requireTimestamps to reject assertions missing conditions; otherwise logs a warning. - Applied in both SAML callback and ACS endpoints. - **Bug Fixes** - Reject expired AuthnRequest records when read from storage, even if cleanup hasn’t run yet. <sup>Written for commit 514cb02a149e3acecc89725942509d705adddff4. 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:13:28 -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#6840