Skip to content

fix(integrity): a broker authorize link spares a sign-in label only when its query names the provider #1494 - #1499

Closed
nc9 wants to merge 4 commits into
mainfrom
fix/integrity-broker-provider-1494
Closed

nc9 wants to merge 4 commits into
mainfrom
fix/integrity-broker-provider-1494

Conversation

@nc9

@nc9 nc9 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1494.

IDENTITY_BROKER_ENDPOINTS matched the host suffix and the path shape of a hosted broker's authorize endpoint. Those hosts let anyone register a tenant and a tenant can serve the path and customise its hosted login page, so a page could borrow the exemption.

Change (packages/rules/src/integrity/signals.ts)

Each broker family now also needs its provider hint in the query, for the brand the label names:

  • Auth0 connection (google-oauth2, windowslive, ...), Cognito identity_provider, Supabase provider, Firebase providerId: the value must be a Google or Microsoft provider name for the matching brand.
  • Okta names a configured identity provider by an opaque id, so any non-empty idp is taken as the hint (a weaker check; the docs say so).
  • A bare authorize URL (the broker's hosted login page) or one naming another provider is judged like any off-brand host. CredentialDestination carries the query.

Review round: a hint in the URL is not proof

The query is written by whoever wrote the link, so "a provider hint exists" cannot spare a control (?idp=google on a hostile tenant would). Now:

  • Auth0, Okta, Cognito (tenant-controlled hosted login pages): the tenant (the host labels before the broker's suffix) must be named after the audited site (example-login.auth0.com on example.com) AND the query must name the provider the label does (Okta: a non-empty idp, since its provider ids are opaque; the tenant is the check there). A foreign tenant is off-brand whatever the URL says, including idp=google, idp=x and connection=google-oauth2.
  • Supabase, Firebase (the endpoint goes straight to the provider, no tenant-controlled login page): the named provider is the whole condition.
  • Cost: a real Auth0/Okta/Cognito login on a tenant not named after the site (a tenant acme-prod on www.acme-group.com is fine, foo-123 on acme.com is not) is now a single-signal info, never a failure. Documented.

Tests (integrity-evasions-784.test.ts, 44 pass)

The existing broker test now uses real federation URLs with their hints. New: bare authorize URLs for all seven endpoint shapes, and URLs naming another provider (including a look-alike value, a hint hidden in another parameter's value, an empty idp), each reported for Google and Microsoft labels, as a link with text and with an aria-label; Microsoft hints are spared for a Microsoft label and reported for a Google one; the bare-broker and plain-off-brand cases are treated alike. These fail without the change (the bare authorize URL was spared).

Docs and CHANGELOG updated. Skill change: none.

nik

Round 2 (independent review)

  • Tenant = FIRST label of the provider host with only the family's own shape after it (.auth0.com + optional region, .okta.com/oktapreview.com/okta-emea.com, .auth.<region>.amazoncognito.com), and it must EQUAL the site name (no hint needed: bare acme.okta.com/oauth2/v1/authorize and acme.auth0.com/authorize are spared, any connection name) or the name plus -prod|production|dev|staging|stage|test|qa|uat|preview (then the provider hint is required). -login, -sso, -secure, -eu, corp, prefixes, deeper labels, look-alikes, punycode are flagged. Floor of 3 letters stays and is documented.
  • The query is parsed only for broker-shaped destinations (and capped at 8,192 chars, a hint past it reads as unhinted).
  • Mutants killed (each by a test): exact vs includes, env startsWith, 3-char floor, idp trim, names() getAll/trim, region, path, tenant check off, env list, query cap.
  • Docs/CHANGELOG/comments corrected; Supabase/Firebase stay spared on the provider alone (integrity/brand-impersonation: tenant-owned broker, B2C and Google user-content hosts still spare an impersonating sign-in #1418).
    Skill change: none.

Round 3 (tests + docs only)

Tests for the review survivors: env hyphen/listed word, 3-5 letter names spared and 2 letters never, hint cap boundary (8,192 spared, 8,193 reported), deeper Okta/Cognito labels, co.uk site, Microsoft/Google provider names, form action and formaction queries for all tenant families. Docs: the hint cap and the residual (an attacker registering the exact tenant name first is spared); duplicate Supabase/Firebase sentence removed. Skill change: none.

nc9 added 4 commits November 1, 2026 17:30
…hen its query names the provider #1494

Signed-off-by: Nik Cubrilovic <[email protected]>
…ironment suffix; query read only for broker-shaped links #1494

Signed-off-by: Nik Cubrilovic <[email protected]>
…ap, co.uk, provider names, form queries); docs residual #1494

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9 nc9 mentioned this pull request Nov 1, 2026
@nc9

nc9 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.156 as 93a0a968, ddcc1092, f1fd7368, 5e7e03ad via #1506.

nik

@nc9 nc9 closed this Nov 1, 2026
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.

integrity/brand-impersonation: a hosted-broker authorize link spares a sign-in label without naming the provider

1 participant