Skip to content

fix(be): keep loopback http gated by explicit allowlist under sso_allow_any_domain#4048

Merged
aterga merged 1 commit into
feat/sso-allow-any-domainfrom
claude/brave-cannon-v0l483
Jun 19, 2026
Merged

fix(be): keep loopback http gated by explicit allowlist under sso_allow_any_domain#4048
aterga merged 1 commit into
feat/sso-allow-any-domainfrom
claude/brave-cannon-v0l483

Conversation

@aterga

@aterga aterga commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

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_domain breaks that invariant: with the flag on, is_allowed_discovery_domain accepts any domain, so a non-allowlisted localhost / 127.0.0.1 now reaches hop-1 and gets a plain-http:// outcall. That is an SSRF/footgun for staging deployments and contradicts the flag's stated "strict-https posture untouched" goal.

Fix

Gate the loopback http downgrade on explicit allowlisting (the same gate hop-2 already uses), so the flag opens the domain gate but never relaxes https:

if matches!(bare.as_str(), "localhost" | "127.0.0.1") && is_explicitly_allowlisted(host) {
    "http"
} else {
    "https"
}
  • A loopback host reachable only via the flag (not on the explicit allowlist) now gets https — no plain-HTTP outcall to loopback.
  • The e2e provider localhost:11107 stays on the explicit sso_discoverable_domains allowlist, so its http path is unaffected (no e2e regression).
  • Adds regression unit test allow_any_domain_does_not_relax_https_for_loopback.

Note: this is stacked on feat/sso-allow-any-domain; it can also just be cherry-picked as a single commit onto that branch.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LDnAektYFmpUWDHPLHypkQ


Generated by Claude Code

…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
@aterga aterga force-pushed the claude/brave-cannon-v0l483 branch from 274cff3 to 001692f Compare June 19, 2026 22:09
@aterga aterga marked this pull request as ready for review June 19, 2026 22:12
@aterga aterga requested a review from a team as a code owner June 19, 2026 22:12
@aterga aterga merged commit 6c19897 into feat/sso-allow-any-domain Jun 19, 2026
18 checks passed
@aterga aterga deleted the claude/brave-cannon-v0l483 branch June 19, 2026 22:12
@zeropath-ai

zeropath-ai Bot commented Jun 19, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 001692f.

Security Overview
Detected Code Changes
Change Type Relevant files
Refactor ► src/internet_identity/src/openid/sso.rs
    Refine logic for determining the scheme for the hop-1 URL to handle explicitly allowlisted loopback hosts and the sso_allow_any_domain flag.

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