Repository navigation
fix: authorize metric CSV export and import rows per metric (CWE-863 authz) - #36792
Conversation
6f8cf82 to
cc674c1
Compare
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
There was a problem hiding this comment.
🟡 Changes recommended
Queued hierarchy writes cause stale authorization checks that can bypass child edit restrictions or wrongly deny later rows, and integration tests leave shared-server fixtures without failure-safe cleanup.
5 open issues
Review effort: Balanced
|
There was a problem hiding this comment.
🔵 Needs a closer look
Authorization checks overlook queued parent updates and dry-run child creations, incorrectly rejecting valid child imports and approving dry-run moves that real imports reject.
4 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because subtree deduplication can skip authorization of queued tag updates, allowing a root move to include a newly protected child.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
# Conflicts: # openmetadata-service/src/test/java/org/openmetadata/service/resources/metrics/MetricGroupResourceTest.java
Code Review ✅ Approved 4 closed / 4 findings🔴 High risk · Adds per-metric authorization and domain filtering to metric CSV exports/imports; incorrect checks could expose restricted metrics or block legitimate writes. Adds per-metric authorization to CSV export and import, covering hierarchy moves, inherited groups, pending parents, and async impersonation to address CWE-863. Resolved this session: import hierarchy checks against stored metrics with no parent or group, duplicated base row authorization that ignored admin skip, and missing EditAll checks on children queued earlier in dry runs. No open issues found. ✅ 4 closed✅ Bug: Import hierarchy check compares against a stored metric with no parent/group
✅ Quality: Metric row check repeats base row authorization and ignores admin skip
✅ Edge Case: Dry run skips EditAll check on children queued earlier in the import
Closed: Quality: Metric-writes ADR still says CSV import skips the hierarchy checks
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 |
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because queued snapshots can bypass move authorization, while large dry-run imports incur quadratic processing and allocation costs.
No open issues 🎉
1 resolved since last review
Review effort: Balanced





Describe your changes:
Fixes metric CSV authorization from advisory ANT-2026-3CSN88IX (CWE-863). There is no public issue for the advisory; the PR uses
skip-pr-checksfollowing #36758.A user allowed to export or import one metric could read or modify metrics outside their permitted scope through CSV. Exports now retain main's per-metric view filtering and also apply domain filtering. Each import row uses the shared
EntityCsvCREATE/EDIT_ALL authorization, with metric-specific checks for the moved subtree and each new parent or metric-group destination. Admin imports skip per-row authorization work.The effective group inherited from a parent is resolved before authorization, including dry runs. A parent created earlier in the same real import is persisted before its policy attributes are checked; dry runs use the successful pending row with its tags and owners. Async imports capture the impersonating bot at submission and restore/clear that attribution around execution, so impersonation-dependent denies still apply.
Type of change:
High-level design:
The generic row-target check remains in
EntityCsv.MetricCsvadds only hierarchy checks through the configured authorizer.MetricRepository.hierarchyMembershipChangedandhierarchyDestinationsare shared with REST/MCP authorization. Existing prerequisite flushing and job arguments are reused.The accepted metric-writes ADR has a dated v2 amendment documenting CSV parity, effective-group resolution, pending-parent authorization, admin skipping, and async attribution, with
MetricCsvAuthorizationITas a guard.Tests:
Verification for
0ae6e7d98ca:MetricCsvDomainIsolationITcovers confined exports and row writes with real policies.MetricCsvAuthorizationITcovers inherited denied groups for create/move, pending-parent tag denies and owner allows, moved-subtree checks (including moving back to root), unchanged membership, and async impersonation. Each scenario exercises dry and real imports. The async denial cases also check PATCH and synchronous imports as controls.Unit coverage checks admin skipping, the configured authorizer, and worker attribution replacement/cleanup on success and failure. Obsolete tests counting the duplicated target check were replaced by API behavior tests. The local job-argument DTO is exercised through submission/serialization/execution in the async IT; it needs no separate getter/setter test. Current coverage percentages were not measured.
Backend integration tests
The full affected-test run is not green; three failures also reproduce on clean main.
MetricCsvAuthorizationIT, including move-to-rootThe three baseline failures are
TeamResourceIT#test_importCsv_ownerDryRunReimportsNestedHierarchy,TeamResourceIT#test_impersonatedOwner_cannotChangeDefaultRolesOrPolicies, andMetricMigrationIT#mergedMigrationUpgradesPopulatedPriorShapeFixture. The same assertions/errors were independently reproduced on clean main at4195406575cfduring the rebase and recur unchanged in this run.The first focused run passed all 108 selected unit tests, all 12 initial new authorization cases, and all 15 existing metric CSV/MCP cases. Five
CsvAsyncJobResourceITdownloads returned HTTP 404 there; the broad branch run had no failures in that class. A fresh clean-main run also produced download 404s (3 of 16 cases). Concurrent admin exports exceed the existing five-results-per-user retention cap; the exact failing cases vary with timing. This pre-existing test interference is not changed here.The search lane initially ran zero tests because its S3 image was removed during startup. After retaining the image with a temporary container, all 46 selected tests passed. The holder is removed after verification.
Commands used the reactor (
-am), the planner's engine/lane profiles, and Failsafe-Dit.test; the affected plan also explicitly addedBotImpersonationITbecause shared CSV authorization now preserves its actor. Before the fixes, the new API tests reproduced the four requested security cases in both modes (8 failures, zero errors); the subtree controls passed.Nightly-only tests not run locally:
LineagePayloadScaleIT,LineageScenePerformanceScaleIT,EntityLoaderSmokeUIIT,SearchAvailableAllKindsDuringReindexUIIT, andSearchAvailableDuringReindexUIIT.Other validation
Spotless,
git diff --check, the Java impact-map branch check, and the decision-record validator pass. No schema, ingestion, or UI changes. The advisory's private Docker reproducer image is unavailable; verification uses real HTTP against the embedded OpenMetadata stack.Checklist:
REVIEW.md.