Repository navigation
[2.1] Authorize Document Store writes in one place (backport 2.1 #38196) - #38227
Conversation
❌ 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 |
|
Local Java test run: PASSED — details
Tests run locally
Broader coverage not executed by this focused run
Commandsmvn -B package -pl openmetadata-mcp -am -Dspring-boot.repackage.skip=true -Dtest=PatchEntityToolTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=DocStoreResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
| requireAdminForEmailTemplates( | ||
| securityContext, cd.getEntityType(), storedEntityType(cd.getFullyQualifiedName())); |
There was a problem hiding this comment.
⚠️ Quality: Two new docStore REST rules are not in any decision record
This PR changes how /v1/docStore behaves in two ways that the UI, SDKs and Collate have to agree with. No record in docs/decisions/ states either rule (the only docStore record is 2026-11-02-persona-layouts-are-readable-through-persona-assignment, which covers reads). The repo squash-merges, so the description is the only place these rules are written down, and they will be lost after merge.
The two rules are:
- From the description: "one helper,
requireAdminForEmailTemplates, that every write endpoint calls". As a record: A Document whose entityType, requested or stored, isEmailTemplatecan only be created, replaced, patched or deleted by an admin, on every docStore write endpoint, whatever Document permissions the caller has. - From the description: "PATCH keeps a document's
entityType, the same way it keeps the name and FQN". As a record: A JSON Patch to a Document never changes itsentityType.DocumentRepository.restorePatchAttributesrestores it, the patch still returns 200, and changing the type means a PUT authorized against both the old and the new type.
Rule 2 is a real contract change. A client that sends replace /entityType now gets a success response and the change is silently dropped. Rule 1 matters because the next person to add a write endpoint has to know to call the helper. The DocStoreResourceIT tests emailTemplatesAreManagedByAdminsOnly and documentPatchKeepsEntityType are the natural guards to name.
Add a record for the two rules (or one record each), name the ITs as guards, and cite it from the helper.:
/** Email templates are rendered into outgoing emails, so only admins manage them. ADR:2026-11-19-email-templates-are-admin-managed-and-patch-keeps-document-type */
private void requireAdminForEmailTemplates(
SecurityContext securityContext, String... entityTypes) {
Was this helpful? React with 👍 / 👎
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
Describe your changes:
Backport of #38196 to
2.1. No linked issue.The email template authorization in the Document Store moves into
DocStoreResource: one helper,requireAdminForEmailTemplates, that every write endpoint calls.DocStoreMapperonly converts the request and validates the template content, and PATCH keeps a document'sentityType, the same way it keeps the name and FQN.The cherry-pick applied cleanly: the change is identical to #38196.
Type of change:
Tests:
Unit tests
Not added, as in #38196: the change is an HTTP authorization rule, covered end to end by
DocStoreResourceIT.Backend integration tests
Local Java test run: PASSED
1ab9d6334055(baseorigin/2.1)--scope full).UI screen recording:
Not applicable: backend-only change.
Checklist:
Fixes #<issue-number>above. No linked issue, as in Authorize Document Store writes in one place #38196.REVIEW.mdwith no 🔴.

Confidence Score: 5/5
This backport appears safe to merge.Summary
This backport puts email-template write checks in
DocStoreResourceand keeps a document's type unchanged during PATCH.No target-branch correctness issues were found. Tests were not run during this review.
Reviews (1) · Last reviewed commit: "[2.1] Authorize Document Store writes in..." · Reviewed by Greptile