Skip to content

fix: strip subdomain header on UAA-zone switch to prevent invitation … - #3990

Merged
strehle merged 1 commit into
developfrom
improve-zone-check
Jul 23, 2026
Merged

fix: strip subdomain header on UAA-zone switch to prevent invitation …#3990
strehle merged 1 commit into
developfrom
improve-zone-check

Conversation

@strehle

@strehle strehle commented Jul 21, 2026

Copy link
Copy Markdown
Member

fix: strip subdomain header on UAA-zone switch to prevent invitation provider-policy bypass

Summary

  • IdentityZoneSwitchingFilter was only stripping X-Identity-Zone-Id when a request resolved to the UAA (system) zone, leaving X-Identity-Zone-Subdomain on the forwarded request.
  • InvitationsEndpoint skips client lookup when either zone header is present, so the leftover subdomain header caused client to remain null.
  • DomainFilter only applies allowed_providers restrictions when a client was loaded — with client == null the per-client identity-provider policy was silently bypassed.
  • A caller with only scim.invite could send X-Identity-Zone-Id: uaa plus any X-Identity-Zone-Subdomain value to invite users via identity providers the OAuth client was explicitly prohibited from using.

…provider-policy bypass

  ## Summary

  - IdentityZoneSwitchingFilter was only stripping X-Identity-Zone-Id when a request resolved to the UAA (system) zone, leaving X-Identity-Zone-Subdomain on the forwarded request.
  - InvitationsEndpoint skips client lookup when either zone header is present, so the leftover subdomain header caused client to remain null.
  - DomainFilter only applies allowed_providers restrictions when a client was loaded — with client == null the per-client identity-provider policy was silently bypassed.
  - A caller with only scim.invite could send X-Identity-Zone-Id: uaa plus any X-Identity-Zone-Subdomain value to invite users via identity providers the OAuth client was explicitly prohibited from using.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens identity-zone switching by ensuring both zone headers are stripped when a request “switches” to the UAA (system) zone, preventing downstream endpoints from interpreting leftover zone headers in a way that bypasses per-client invitation provider restrictions.

Changes:

  • Strip X-Identity-Zone-Subdomain in addition to X-Identity-Zone-Id when the resolved zone is the UAA zone.
  • Add a regression test asserting both headers are removed in the UAA-zone “superfluous switch” path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
server/src/main/java/org/cloudfoundry/identity/uaa/zone/IdentityZoneSwitchingFilter.java Extends the header-stripping wrapper to remove both zone headers when the resolved zone is UAA.
server/src/test/java/org/cloudfoundry/identity/uaa/zone/IdentityZoneSwitchingFilterTests.java Adds a test verifying both headers are removed when switching to the UAA zone.

@github-project-automation github-project-automation Bot moved this from Inbox to Pending Merge | Prioritized in Foundational Infrastructure Working Group Jul 23, 2026
@strehle
strehle merged commit 49aa772 into develop Jul 23, 2026
27 checks passed
@strehle
strehle deleted the improve-zone-check branch July 23, 2026 15:28
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants