[PR #8608] fix(sso): read InResponseTo from extract.response instead of extract #16341

Open
opened 2026-04-13 10:29:53 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/8608

State: open
Merged: No


Fixes #8607
The SAML login handlers read extract.inResponseTo, but samlify nests
the Response attributes under extract.response. This causes
InResponseTo to always be undefined, making
enableInResponseToValidation reject every SP-initiated login.
The logout handler in the same file already reads the correct path
(extract?.response?.inResponseTo). This PR aligns the two login
handlers to match.


Summary by cubic

Fixes SP-initiated SAML logins failing when enableInResponseToValidation is on by reading InResponseTo from extract.response.inResponseTo. Adds a full SP-initiated validation test and tightens unsolicited-response tests.

  • Bug Fixes
    • In packages/sso/src/routes/sso.ts, callbackSSOSAML and acsEndpoint now read extract.response?.inResponseTo.
    • In packages/sso/src/types.ts, extend SAMLAssertionExtract with response.inResponseTo.
    • In packages/sso/src/saml.test.ts, add SP-initiated test that extracts the AuthnRequest ID from the deflated SAMLRequest and uses it as InResponseTo; update the mock IdP to accept a dynamic inResponseTo; unsolicited tests send an empty value; fix a test typecheck.

Written for commit b09762afeb. Summary will update on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/8608 **State:** open **Merged:** No --- Fixes #8607 The SAML login handlers read `extract.inResponseTo`, but samlify nests the Response attributes under `extract.response`. This causes `InResponseTo` to always be `undefined`, making `enableInResponseToValidation` reject every SP-initiated login. The logout handler in the same file already reads the correct path (`extract?.response?.inResponseTo`). This PR aligns the two login handlers to match. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes SP-initiated SAML logins failing when `enableInResponseToValidation` is on by reading `InResponseTo` from `extract.response.inResponseTo`. Adds a full SP-initiated validation test and tightens unsolicited-response tests. - **Bug Fixes** - In `packages/sso/src/routes/sso.ts`, `callbackSSOSAML` and `acsEndpoint` now read `extract.response?.inResponseTo`. - In `packages/sso/src/types.ts`, extend `SAMLAssertionExtract` with `response.inResponseTo`. - In `packages/sso/src/saml.test.ts`, add SP-initiated test that extracts the AuthnRequest ID from the deflated `SAMLRequest` and uses it as `InResponseTo`; update the mock IdP to accept a dynamic `inResponseTo`; unsolicited tests send an empty value; fix a test typecheck. <sup>Written for commit b09762afeb2aeeb675d9420a88eadfa4febd14a7. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 10:29:53 -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#16341