Jackie-Jiang commented on code in PR #20426:
URL: https://github.com/apache/pinot/pull/20426#discussion_r4806956683


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ResourceUtils.java:
##########
@@ -90,6 +94,34 @@ public static void checkPermissionAndAccess(String typeName, 
Request request, Ht
     }
   }
 
+  /// Checks publication authority for the resolved physical destination of a 
segment mutation.
+  static void checkMaterializedViewWrite(String tableNameWithType, HttpHeaders 
headers,
+      PinotHelixResourceManager resourceManager, AccessControlFactory 
accessControlFactory, Logger logger) {
+    if (TableNameBuilder.isOfflineTableResource(tableNameWithType)) {
+      checkMaterializedViewWrite(tableNameWithType, 
resourceManager.getTableConfig(tableNameWithType), headers,
+          resourceManager, accessControlFactory, logger);
+    }
+  }
+
+  static void checkMaterializedViewWrite(String tableNameWithType, @Nullable 
TableConfig tableConfig,
+      HttpHeaders headers, PinotHelixResourceManager resourceManager, 
AccessControlFactory accessControlFactory,
+      Logger logger) {
+    if (!TableNameBuilder.isOfflineTableResource(tableNameWithType)) {
+      return;

Review Comment:
   [P1] Protect shared storage from REALTIME uploads
   
   The REALTIME early return bypasses protection of the view's backing files. A 
principal excluded from the publisher allowlist but with ordinary table CREATE 
permission can create `view_REALTIME` alongside `view_OFFLINE` through `POST 
/tables`: `checkHybridTableConfig()` / `verifyHybridTableConfigs()` only check 
matching time columns and broker tenants. Uploading an existing MV segment name 
to that REALTIME table then overwrites the same deep-store object, because both 
variants use `<dataDir>/<rawTableName>/<segmentName>` 
(`PinotSegmentUploadDownloadRestletResource`, lines 439–449). Realtime uploads 
accept these non-LLC names, and `ZKOperator.processNewSegment()` copies the 
file before segment assignment.
   
   Please enforce MV raw-name exclusivity in shared table-creation validation, 
or protect shared-storage writes whenever the OFFLINE counterpart is a managed 
view. A regression covering counterpart creation and upload by a nonpublisher 
would verify this boundary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to