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

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8608
Author: @evanenochs
Created: 3/14/2026
Status: Closed

Base: mainHead: fix/saml-inresponseto-extract-path


📝 Commits (3)

  • 31734d1 fix(sso): read InResponseTo from extract.response instead of extract
  • 5bdd6ec test(sso): add SP-initiated InResponseTo validation test
  • b09762a fix(sso): fix typecheck error in saml test

📊 Changes

3 files changed (+122 additions, -25 deletions)

View changed files

📝 packages/sso/src/routes/sso.ts (+4 -6)
📝 packages/sso/src/saml.test.ts (+115 -19)
📝 packages/sso/src/types.ts (+3 -0)

📄 Description

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.


🔄 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/8608 **Author:** [@evanenochs](https://github.com/evanenochs) **Created:** 3/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/saml-inresponseto-extract-path` --- ### 📝 Commits (3) - [`31734d1`](https://github.com/better-auth/better-auth/commit/31734d17f2bb6885f999e70c0a87bcabc976cafc) fix(sso): read InResponseTo from extract.response instead of extract - [`5bdd6ec`](https://github.com/better-auth/better-auth/commit/5bdd6ecc7cea1f6fb24baa7560f49804a2407726) test(sso): add SP-initiated InResponseTo validation test - [`b09762a`](https://github.com/better-auth/better-auth/commit/b09762afeb2aeeb675d9420a88eadfa4febd14a7) fix(sso): fix typecheck error in saml test ### 📊 Changes **3 files changed** (+122 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `packages/sso/src/routes/sso.ts` (+4 -6) 📝 `packages/sso/src/saml.test.ts` (+115 -19) 📝 `packages/sso/src/types.ts` (+3 -0) </details> ### 📄 Description 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. --> --- <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-15 22:40:52 -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#24995