Skip to content

fix: bind impersonation restrictions to the routed resource method - #36231

Merged
manerow merged 2 commits into
mainfrom
fix/impersonation-route-binding
Oct 26, 2026
Merged

manerow merged 2 commits into
mainfrom
fix/impersonation-route-binding

Conversation

@manerow

@manerow manerow commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Moves the impersonation check on identity endpoints from a path list to a JAX-RS name binding, and keeps privileged user changes out of impersonated requests.

  • New @IdentityEndpoint annotation (a JAX-RS @NameBinding, same pattern as @LatencyPhase). ImpersonationRestrictionFilter runs only for annotated methods, and the path list is removed.
  • The credential and session methods of UserResource and the write methods of BotResource are annotated.
  • UserResource.authorizeAdminForPrivilegedFields refuses impersonated callers for privileged fields (admin, bot, roles, domains, closed teams) on POST, PUT and PATCH. It reads the impersonation from ContainerRequestContext, because the injected SecurityContext is a Jersey proxy that hides it.

Only requests that send X-Impersonate-User are affected. The UI never sends it, and the application bots that do don't call these endpoints.

Type of change:

  • Improvement

High-level design:

docs/decisions/2026-10-26-impersonated-requests-never-reach-credentials-or-grant-privileges.md records the rule. A new endpoint that creates, reveals, rotates or revokes a credential opts in with one annotation.

Tests:

Unit tests

  • ImpersonationRestrictionFilterTest: pins the annotated UserResource methods and checks that the filter denies an impersonated request and allows a direct one.

Backend integration tests

  • BotImpersonationIT: identity endpoints, bot writes and privileged user changes are refused while impersonating, and ordinary impersonated calls still work. 25/25 locally.

Ingestion integration tests

  • Not applicable.

Playwright (UI) tests

  • Not applicable.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration) and listed them above.
  • I have added a test that covers the exact scenario we are fixing.

@manerow
manerow requested a review from a team as a code owner October 26, 2026 10:09
@manerow
manerow requested a review from IceS2 October 26, 2026 10:09
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 26, 2026
@manerow
manerow added this pull request to the merge queue Oct 26, 2026
manerow added a commit that referenced this pull request Oct 26, 2026
…ackport 2.0 #36231) (#36233)

* fix: bind impersonation restrictions to the routed resource method

* fix: refuse impersonated privilege grants through user PATCH and record the rule
@sonarqubecloud

Copy link
Copy Markdown

Merged via the queue into main with commit 88deea1 Oct 26, 2026
87 of 91 checks passed
@manerow
manerow deleted the fix/impersonation-route-binding branch October 26, 2026 14:58
@open-metadata open-metadata deleted a comment from gitar-bot Bot Oct 29, 2026
@open-metadata open-metadata deleted a comment from gitar-bot Bot Oct 29, 2026
@open-metadata open-metadata deleted a comment from greptile-apps Bot Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants