Skip to content

Fixes 33420: authorize the target domain when an asset is reassigned (backport 2.0 #33471) - #35798

Merged
manerow merged 1 commit into
2.0from
fix/33420-asset-reassignment-authz-2.0
Oct 21, 2026
Merged

manerow merged 1 commit into
2.0from
fix/33420-asset-reassignment-authz-2.0

Conversation

@manerow

@manerow manerow commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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 EditDomains operation, 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:

  1. Add and remove assets on domains and data products. On main, these endpoints are covered by PR #35026, which checks each asset as its own PATCH and returns refused assets as failed rows. That PR is not on 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.
  2. UI. Only the regenerated types and the new operation in the Admin Permission Debugger come across. On main, the domain edit controls follow EditDomains through PermissionDerivation, which 2.0 does not have. On 2.0 the controls keep following EditAll, which still includes EditDomains, 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, JsonPatchUtilsTest and CatalogExceptionMessageTest (25 tests), and DomainReassignmentAuthorizationIT (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.

RetriggerView in GreptileConfidence Score: 1/5

Do not merge until both remaining ways to enter an unheld domain are closed and the explicit repository requirements are satisfied.

Findings

  1. P1 Security Mixed domains bypass the check ▶
  2. P1 Security Clearing skips the inherited domain ▶
  3. P2 New helpers use early returns ▶
  4. P2 Unchanged variables lack final ▶
  5. P2 First-element reads use indexes ▶
  6. P2 Patch helpers repeat request code ▶
  7. P2 Target list can be changed ▶
  8. P2 Tests mock internal code ▶

Summary

Adds EditDomains and a second permission check for PATCH and PUT domain changes.

  • Asset moves now check whether the caller can access the destination domain.
  • Domain and data product bulk asset changes check each selected asset.

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 EditAll because PermissionDerivation is 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]
Loading

Reviews (1) · Last reviewed commit: "Fixes 33420: authorize the target domain..." · Reviewed by Greptile

@manerow
manerow requested review from a team as code owners October 20, 2026 12:56
@manerow
manerow requested review from harshach and removed request for a team October 20, 2026 12:56
@manerow manerow added the skip-pr-checks Bypass PR metadata validation check label Oct 20, 2026
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 20, 2026
@gitar-bot

gitar-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
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 EditDomains operation and a second authorization check so domain changes on single PUT and PATCH are validated against the target domain, with a 403 naming the domain on denial. The bulk /bulk createOrUpdate path still only checks the stored entity, so a user with a hasDomain() grant can move assets into unheld domains through it; this needs the same target-domain check applied per row, with an integration test for the bulk endpoint, before merge.

✅ 1 closed
Closed: Security: Bulk PUT path still moves assets into unheld domains unchecked

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/EntityResource.java:620-623 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/EntityResource.java:655-658 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/EntityResource.java:675-689
This PR adds authorizeDomainChange to single PUT and PATCH, but processBulkRequest (used by the /bulk createOrUpdate endpoints) still only runs EDIT_ALL against the stored entity (existingEntity, lines 1638-1645) before calling repository.bulkCreateOrUpdateEntities. Take a user whose grant is hasDomain(), and a table that is in their domain or has no domain (hasDomain() returns true for a domainless asset). The user can send that table to the bulk endpoint with domains set to a domain they don't hold. The stored context passes, and the move is saved, which is the same bypass #33420 describes. To fix it, call authorizeDomainChange(securityContext, resourceContext, appliedPutDomains(securityContext, resourceContext, entity)) inside the else branch, so a denial becomes a 403 row in the bulk result. Add an IT case for the bulk endpoint too.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 68%
68.3% (82877/121333) 53.2% (51318/96458) 53.95% (15270/28303)

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@manerow
manerow enabled auto-merge (squash) October 21, 2026 07:07
@manerow
manerow disabled auto-merge October 21, 2026 07:14
@manerow
manerow merged commit ab665fe into 2.0 Oct 21, 2026
131 of 166 checks passed
@manerow
manerow deleted the fix/33420-asset-reassignment-authz-2.0 branch October 21, 2026 07:16

This branch was previously deployed

1 inactive deployment
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 skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants