fix(be): keep loopback http gated by explicit allowlist under sso_allow_any_domain#4048
Merged
Merged
Conversation
…ow_any_domain The hop-1 discovery scheme was chosen purely on whether the host was loopback, on the assumption that only allowlisted domains ever reached discovery. `sso_allow_any_domain` breaks that invariant: with the flag on, `is_allowed_discovery_domain` accepts any domain, so a non-allowlisted `localhost`/`127.0.0.1` could reach hop-1 and get a plain-`http://` outcall — an SSRF footgun that contradicts the flag's "strict-https posture untouched" goal. Gate the loopback `http` downgrade on explicit allowlisting (the same gate hop-2 uses), so the flag opens the domain gate but never relaxes `https`. The e2e provider `localhost:11107` stays explicitly allowlisted, so its http path is unaffected. Adds a regression unit test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LDnAektYFmpUWDHPLHypkQ
274cff3 to
001692f
Compare
|
✅ No security or compliance issues detected. Reviewed everything up to 001692f. Security Overview
Detected Code Changes
|
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.
Addresses the review comment on #4045 (#4045 (comment)).
Problem
Hop-1 of SSO discovery chooses its scheme via
scheme_for_allowlisted_host, which keyed only on whether the host was loopback (localhost/127.0.0.1) — it never consulted the allowlist. That was safe only under the prior invariant that every domain reaching discovery was already explicitly allowlisted.sso_allow_any_domainbreaks that invariant: with the flag on,is_allowed_discovery_domainaccepts any domain, so a non-allowlistedlocalhost/127.0.0.1now reaches hop-1 and gets a plain-http://outcall. That is an SSRF/footgun for staging deployments and contradicts the flag's stated "strict-httpsposture untouched" goal.Fix
Gate the loopback
httpdowngrade on explicit allowlisting (the same gate hop-2 already uses), so the flag opens the domain gate but never relaxeshttps:https— no plain-HTTP outcall to loopback.localhost:11107stays on the explicitsso_discoverable_domainsallowlist, so itshttppath is unaffected (no e2e regression).allow_any_domain_does_not_relax_https_for_loopback.🤖 Generated with Claude Code
https://claude.ai/code/session_01LDnAektYFmpUWDHPLHypkQ
Generated by Claude Code