Repository navigation
Authorize every row of a CSV import, not only the import root - #36077
Conversation
The import endpoint checked EDIT_ALL on the entity being imported into, but a row can name any entity by FQN (recursive service import) or by name (teams, glossary terms under another glossary's parent), so a caller who could edit one entity could rewrite metadata of entities they had no rights on. Each row is now authorized as its own write: EDIT_ALL on an existing entity, CREATE for a new one. A denied row is reported as failed; the rest of the import continues.
❌ 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 |
A new row whose parent was created by an earlier row of the same import is part of the subtree that row's check allowed; its parent cannot be loaded for owner inheritance until the batch is written, or at all in a dry run. Adds owner-path ITs: re-import and new hierarchy by a service owner, nested new glossary terms, and a new sub-team, each in dry run and real run.
A row creating an entity under a parent created earlier in the same file is checked on its own type, against that parent as the file defines it, in dry and real runs alike.
Uses TestCaseWriteAuthRequests, as the REST and ODCS paths do, before anything is created for the row.
…eir table patch An admin's import skips the per-row checks, as the authorizer does. New entities are tracked by reference once their row succeeds, and a parent's view is built only for parents with child rows, taking owners only where its type inherits them. Teams are checked against all parents.
Column rows skip the table check only when the entity this import created under that FQN is a table; another type with the same FQN, such as a stored procedure, does not cover them.
A row passes when one permission allows it and none denies it explicitly, matching AuthorizationLogic.ANY on the test case write endpoints.
Code Review ✅ Approved 6 closed / 6 findings🔴 High risk · Per-row CSV authorization now governs entity and column writes; errors in row or parent checks could permit unauthorized metadata changes. Adds per-row authorization to CSV import so each row is checked as its own write, matching the corresponding REST call, and refused rows fail individually while the rest of the import continues. Owner-based CREATE for rows under parents created earlier in the same file, test case row authorization, the decision record, and child CREATE checks for imported parents were all addressed. No open issues remain; the ADR wording about stored versus copied parents is closed without a fix. ✅ 6 closed✅ Edge Case: Owner-based CREATE fails for rows whose new parent is only in this import
✅ Security: Test case CSV import still writes rows without per-row authorization
✅ Quality: New per-row CSV import authorization rule is not recorded in docs/decisions
✅ Security: Children of an imported create skip their own CREATE check entirely
✅ Edge Case: Dry run passes children of a refused parent that the real run fails
...and 1 more closed from earlier reviews 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 |
Fixes open-metadata/openmetadata-collate#7802
Summary
CSV import now authorizes each row as its own write, the same as the matching REST call, instead of relying on the check made for the entity being imported into.
What changed
EntityCsv.authorizeRowruns for everyEntityCsvimporter row and for column rows:EDIT_ALLon an existing entity,CREATEon a new one, checked for the importing user. A refused row fails on its own and the rest of the import continues, in dry runs too.CreateResourceContextconstructor for a parent that is not stored yet).TestCaseWriteAuthRequests, as the REST and ODCS paths are, before anything is created for the row.docs/decisions/2026-11-02-a-csv-import-authorizes-each-row-as-its-own-write.md.Behaviour change: a row needs the same permission REST would need. For example, databases do not inherit their service's owners, so a service owner who does not own a child database gets failed rows for it.
Details
Authorizer.authorizeActor(ChangeActor, …), the mechanismauthorizeImportedDomainsalready uses inside the import, and fails closed with no authorizer registered."svc.db".schema).EntityCsvTest.TestCsvoverridesauthorizeRowas a no-op; policy behaviour is covered by the ITs.createUserEntity) keeps its own checks and is not changed here.DatabaseServiceResourceIT(test_recursiveImportCannotEditEntitiesOutsideCallerPermissions,test_recursiveImportByServiceOwnerCreatesAndUpdatesOwnHierarchy,test_recursiveImportChecksEachNewRowAgainstItsOwnType,test_recursiveImportCannotEditColumnsOfTableOutsideCallerPermissions),GlossaryResourceIT,TeamResourceIT,TestCaseCsvDomainIsolationIT.test_importCsv_rowIsCheckedAgainstItsOwnTable. The new checks fail without the change. The CSV-import IT classes (Database, DatabaseSchema, DatabaseService, DriveService, Glossary, Team, User, TestCaseCsvDomainIsolation) pass: 1745 tests, 0 failures.Do not merge yet: child creates can bypass explicit permission denies, and nested team imports still fail.
Findings
Summary
The PR adds per-row permission checks to CSV imports, including table writes made through column rows.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[New CSV row] --> B{Parent tracked as authorized?} B -->|No| C[Check CREATE for this row] B -->|Yes| D[Skip this row's CREATE check] C -->|Allowed| E[Queue row] D --> E E --> F[Save batch]Reviews (2) · Last reviewed commit: "Let an import create under parents it cr..." · Reviewed by Greptile
Companion Collate PR: https://github.com/open-metadata/openmetadata-collate/pull/8214 (onboarding sample data imports as the installing user).