Skip to content

fix: scope SSO auth detection to host and endpoint paths, document --safe-domain#1243

Merged
tw93 merged 2 commits into
tw93:mainfrom
xantorres:fix/sso-link-detection
Jun 21, 2026
Merged

fix: scope SSO auth detection to host and endpoint paths, document --safe-domain#1243
tw93 merged 2 commits into
tw93:mainfrom
xantorres:fix/sso-link-detection

Conversation

@xantorres

Copy link
Copy Markdown
Contributor

Problem

The enterprise SSO matchers used to keep sign-in flows in-app (Okta, OneLogin, SAML, SSO, ADFS) are tested against the entire URL. As a result, ordinary application pages are misclassified as authentication — their click handlers are stopped and navigation is forced. Examples:

  • /settings/sso/providers (a settings page)
  • /docs/saml/overview (a docs page)
  • https://app.example.com/?next=https://idp.example.com/sso/saml (an SSO URL carried in a query string)

Changes

  • Scope the matching. Identity providers (Okta, OneLogin) are matched on the hostname; SAML/SSO/ADFS are matched on the pathname with endpoint-shaped patterns (/saml/acs, /sso/redirect, /adfs/ls, …). Ordinary pages and query strings no longer trigger auth handling. The existing oauthPatterns are left unchanged.
  • Document --safe-domain. Add it to the EN/CN CLI reference: host-bound semantics, precedence vs --internal-url-regex, and an example.

Tests

Adds false-positive coverage (settings/docs paths, a query-carried SSO URL, a look-alike suffix host such as okta.com.evil.test) alongside the existing provider/endpoint cases. Full Vitest suite passes; Prettier check clean.

Test plan

pake https://app.slack.com --safe-domain slack.com,okta.com

SSO sign-in stays inside the app window. Navigating to an in-app /settings/sso/... page now behaves normally instead of being hijacked as an authentication redirect.

The enterprise SSO matchers (Okta, OneLogin, SAML, SSO, ADFS) were tested against the entire URL, so ordinary pages such as /settings/sso/providers, a docs path like /docs/saml/overview, or a query string merely carrying an SSO URL were misclassified as authentication and had their navigation forced. Match identity providers on the hostname and SAML/SSO/ADFS on the pathname with endpoint-shaped patterns instead; the existing oauthPatterns are unchanged. Also document --safe-domain in the EN/CN CLI reference (host-bound semantics and precedence vs --internal-url-regex).
@tw93 tw93 merged commit 6efafd4 into tw93:main Jun 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants