mirror of
https://github.com/better-auth/better-auth.git
synced 2026-07-27 16:53:02 -05:00
1.6 KiB
1.6 KiB
@better-auth/sso
| @better-auth/sso |
|---|
| minor |
fix(sso)!: harden SAML response validation (InResponseTo, Audience, SessionIndex)
Breaking Changes
allowIdpInitiatednow defaults tofalse— IdP-initiated SSO (unsolicited SAML responses) is disabled by default. Setsaml.allowIdpInitiated: trueto restore the previous behavior. This aligns with the SAML2Int interoperability profile which recommends against IdP-initiated SSO due to its susceptibility to injection attacks.
Bug Fixes
- InResponseTo validation was completely non-functional — The code read
extract.inResponseTo(alwaysundefined) instead of samlify's actual pathextract.response.inResponseTo. SP-initiated InResponseTo validation now works as intended in both ACS handlers. - Audience Restriction was never validated — SAML assertions issued for a different service provider were accepted without checking the
<AudienceRestriction>element. Audience is now validated against the configuredsamlConfig.audiencevalue per SAML 2.0 Core §2.5.1. - SessionIndex stored as object instead of string — samlify returns
sessionIndexfrom login responses as{ authnInstant, sessionNotOnOrAfter, sessionIndex }, but the code stored the whole object. SLO session-index comparisons always failed silently. The correct innersessionIndexstring is now extracted.
Improvements
- Extracted shared
validateInResponseTo()andvalidateAudience()intopackages/sso/src/saml/response-validation.ts, eliminating ~160 lines of duplicated validation logic between the two ACS handlers. - Fixed
SAMLAssertionExtracttype to match samlify's actual extractor output shape.