PPT-2536: enforce ensure_matching + fix continue lost through SSO - #5
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes:
continuelost through provider logins — the callback consumed the session-storedcontinueafterremove_session/new_sessionhad 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.ensure_matchingenforcement (security) — hosted-domain/attribute restrictions configured on an OAuth strat were silently ignored. Restores the Rubygeneric_oauth#raw_infosemantics (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