Repository navigation
fix: bind impersonation restrictions to the routed resource method - #36231
Merged
Merged
Conversation
Contributor
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
sonika-shah
approved these changes
Oct 26, 2026
manerow
added this pull request to the merge queue
Oct 26, 2026
|
1 task done
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.



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.
@IdentityEndpointannotation (a JAX-RS@NameBinding, same pattern as@LatencyPhase).ImpersonationRestrictionFilterruns only for annotated methods, and the path list is removed.UserResourceand the write methods ofBotResourceare annotated.UserResource.authorizeAdminForPrivilegedFieldsrefuses impersonated callers for privileged fields (admin, bot, roles, domains, closed teams) on POST, PUT and PATCH. It reads the impersonation fromContainerRequestContext, because the injectedSecurityContextis a Jersey proxy that hides it.Only requests that send
X-Impersonate-Userare affected. The UI never sends it, and the application bots that do don't call these endpoints.Type of change:
High-level design:
docs/decisions/2026-10-26-impersonated-requests-never-reach-credentials-or-grant-privileges.mdrecords the rule. A new endpoint that creates, reveals, rotates or revokes a credential opts in with one annotation.Tests:
Unit tests
ImpersonationRestrictionFilterTest: pins the annotatedUserResourcemethods 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
Playwright (UI) tests
UI screen recording / screenshots:
Not applicable.
Checklist: