[PR #7781] [MERGED] fix(sso): fix broken relay state redirect on SAML ACS route #15798

Closed
opened 2026-04-13 10:13:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7781
Author: @rbayliss
Created: 2/3/2026
Status: Merged
Merged: 2/4/2026
Merged by: @himself65

Base: canaryHead: fix/sso-acs-relaystate


📝 Commits (2)

  • cce000a fix(sso): fix broken relay state redirect on SAML ACS route
  • 84f96d9 Fix missing path segment

📊 Changes

1 file changed (+37 additions, -9 deletions)

View changed files

📝 packages/sso/src/routes/sso.ts (+37 -9)

📄 Description

This is a naive fix for #7777 - it carries the same changes from #6675 over to the /sso/saml/acs/:providerId route. Please feel free to edit or replace this PR if desired - my only goal here is to get the issue fixed.


Summary by cubic

Fixes RelayState redirects on the SAML ACS route so users return to the correct app page after login, with safe origin validation to prevent open redirects. Aligns /sso/saml/acs/:providerId behavior with the saml2 ACS route.

  • Bug Fixes
    • Parse RelayState and use relayState.callbackURL instead of the raw value.
    • Validate redirects with getSafeRedirectUrl (origin and callback path checks).
    • Respect parsed RelayState for error redirects; fallback to provider callbackUrl or baseURL.

Written for commit 84f96d923b. 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/7781 **Author:** [@rbayliss](https://github.com/rbayliss) **Created:** 2/3/2026 **Status:** ✅ Merged **Merged:** 2/4/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/sso-acs-relaystate` --- ### 📝 Commits (2) - [`cce000a`](https://github.com/better-auth/better-auth/commit/cce000a2a1bdd26b8a76648f85758e9fcbc61472) fix(sso): fix broken relay state redirect on SAML ACS route - [`84f96d9`](https://github.com/better-auth/better-auth/commit/84f96d923b1f40bdf00be6a1a35622b713b59d04) Fix missing path segment ### 📊 Changes **1 file changed** (+37 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `packages/sso/src/routes/sso.ts` (+37 -9) </details> ### 📄 Description This is a naive fix for #7777 - it carries the same changes from #6675 over to the `/sso/saml/acs/:providerId` route. Please feel free to edit or replace this PR if desired - my only goal here is to get the issue fixed. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes RelayState redirects on the SAML ACS route so users return to the correct app page after login, with safe origin validation to prevent open redirects. Aligns /sso/saml/acs/:providerId behavior with the saml2 ACS route. - **Bug Fixes** - Parse RelayState and use relayState.callbackURL instead of the raw value. - Validate redirects with getSafeRedirectUrl (origin and callback path checks). - Respect parsed RelayState for error redirects; fallback to provider callbackUrl or baseURL. <sup>Written for commit 84f96d923b1f40bdf00be6a1a35622b713b59d04. 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-13 10:13:51 -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#15798