Skip to content

PPT-2536: enforce ensure_matching + fix continue lost through SSO - #5

Merged
camreeves merged 3 commits into
masterfrom
PPT-2536-ensure-matching-continue
Jul 17, 2026
Merged

PPT-2536: enforce ensure_matching + fix continue lost through SSO#5
camreeves merged 3 commits into
masterfrom
PPT-2536-ensure-matching-continue

Conversation

@camreeves

Copy link
Copy Markdown
Contributor

Two fixes:

  1. continue lost through provider logins — the callback consumed the session-stored continue after remove_session/new_session had already cleared the session, so every SSO login landed on / instead of returning to the originating app (reproduced manually on dev). Consume it before the session resets.
  2. ensure_matching enforcement (security) — hosted-domain/attribute restrictions configured on an OAuth strat were silently ignored. Restores the Ruby generic_oauth#raw_info semantics (per-field, first-match, case-insensitive regex; failure → /auth/failure). Empty config short-circuits to allow — zero change for unrestricted authorities (verified: all dev strats have {}).

Specs cover the continue round-trip (login → kickoff → callback → Location: /backoffice/) and both ensure_matching outcomes incl. no user being minted on rejection. WebMock specs validated in CI (OOM locally alongside the running stack).

🤖 Generated with Claude Code

camreeves and others added 3 commits July 18, 2026 01:24
The callback consumed the session-stored continue AFTER remove_session/
new_session had cleared the session store, so every SSO login landed on
"/" instead of returning to the app that started it (Ruby preserved
continue across the round-trip). Consume it up front — before
session_user's stale-session teardown and the deliberate session reset —
and use the captured value for the final redirect.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
An authority that restricted OAuth logins to a corporate domain (e.g.
ensure_matching = {"email" => ["@corp.example$"]}) was silently
unenforced — any account from the provider could log in. Restore the
legacy generic_oauth#raw_info semantics: for every configured field, at
least one of the userinfo values must match one of its (case-insensitive,
unanchored) regex patterns; failures bounce to /auth/failure exactly like
other provider errors. Empty config (the overwhelmingly common case)
short-circuits to allow, so unrestricted authorities see zero change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@camreeves
camreeves merged commit 577107d into master Jul 17, 2026
7 checks passed
@camreeves
camreeves deleted the PPT-2536-ensure-matching-continue branch July 21, 2026 04:00
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.

1 participant