Repository navigation
Fixes 33420: authorize the target domain when an asset is reassigned (backport 2.0 #33471) - #35798
Conversation
Code Review ✅ Approved 1 closed / 1 findings🔴 High risk · Changes authorization for domain reassignment and bulk asset moves; a regression could expose assets across domains or deny legitimate transfers. Adds a new ✅ 1 closedClosed: Security: Bulk PUT path still moves assets into unheld domains unchecked
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|



Issue
Cherry-pick of #33471 (Fixes #33420) onto
2.0, for 2.0.6.Problem
A user whose policy is scoped with
hasDomain()could move assets into domains they do not hold. Moving an asset was only checked against the domain it was leaving, never the one it was moving into. The domain and data product "Add Assets" pickers checked the target, but not the assets being pulled in.What this backport changes
The same fix as #33471: a new
EditDomainsoperation, and a second check that every domain change (PATCH and PUT) is allowed for the domain the asset moves into. A denied move now returns a 403 that names the domain.Two parts differ from main, on purpose:
2.0. So this backport keeps the per-asset check Fixes 33420: authorize the target domain when an asset is reassigned #33471 carried before it merged: if the request includes an asset the caller may not edit, the whole request is refused with a 403 and nothing moves. The integration tests for these endpoints expect that 403.EditDomainsthroughPermissionDerivation, which2.0does not have. On2.0the controls keep followingEditAll, which still includesEditDomains, so existing policies show the same controls. A move the server refuses shows the new 403 message.What users will notice
A domain admin can still move assets inside the domains they hold and claim assets they may edit. Moving an asset into another team's domain, or pulling another team's asset into theirs, is now refused.
How it was tested
On this branch, on Postgres:
UpdatedDomainsResourceContextTest,JsonPatchUtilsTestandCatalogExceptionMessageTest(25 tests), andDomainReassignmentAuthorizationIT(13 cases), all passing.With the per-asset checks on the add-assets endpoints removed, exactly the three bulk security cases fail (domain add, domain add of an asset with an inherited domain, data product add). So the cherry-pick alone would leave those endpoints open on
2.0, and the tests cover the part that differs from main.Do not merge until both remaining ways to enter an unheld domain are closed and the explicit repository requirements are satisfied.
Findings
Summary
Adds
EditDomainsand a second permission check for PATCH and PUT domain changes.Two permission gaps remain: mixed target lists can include unheld domains, and clearing an assignment can enter an unheld inherited domain. The added Java code also needs to satisfy the repository rules listed above.
Intentional differences acknowledged by manerow: bulk requests fail together with a 403, and the backport keeps domain controls tied to
EditAllbecausePermissionDerivationis unavailable.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[PATCH or PUT asset] --> B[Check stored asset] B --> C[Calculate target domains] C --> D[Resolve target references by ID] D --> E[Check EditDomains with target context] E --> F[Save update] C -. Clearing assignment .-> G[Empty list misses inherited domain] E -. Multiple domains .-> H[One matching domain allows whole list]Reviews (1) · Last reviewed commit: "Fixes 33420: authorize the target domain..." · Reviewed by Greptile