xiangfu0 commented on code in PR #20456:
URL: https://github.com/apache/pinot/pull/20456#discussion_r4795808199


##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java:
##########
@@ -528,12 +533,23 @@ private QueryEnvironment.CompiledQuery compileQuery(long 
requestId, String query
     }
   }
 
-  private boolean checkAuthorization(RequesterIdentity requesterIdentity, 
RequestContext requestContext,
+  @VisibleForTesting
+  boolean checkAuthorization(RequesterIdentity requesterIdentity, 
RequestContext requestContext,
       HttpHeaders httpHeaders, QueryEnvironment.CompiledQuery compiledQuery) {
     Set<String> tables = compiledQuery.getTableNames();
     if (tables != null && !tables.isEmpty()) {
+      Set<String> tablesToAuthorize = new HashSet<>(tables);
+      for (String table : tables) {
+        String logicalTableName = _tableCache.getActualLogicalTableName(table);
+        if (logicalTableName != null) {
+          LogicalTableConfig config = 
_tableCache.getLogicalTableConfig(logicalTableName);
+          if (config != null) {
+            
tablesToAuthorize.addAll(config.getPhysicalTableConfigMap().keySet());

Review Comment:
   File-backed Basic Auth now accepts a raw or matching typed grant for the 
physical source, with exclusions taking precedence. This applies to both the 
configured mapping and the routed plan. Added the upgrade note and 
compatibility label in this PR. The two focused broker suites passed (34 tests).



##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java:
##########
@@ -528,12 +533,23 @@ private QueryEnvironment.CompiledQuery compileQuery(long 
requestId, String query
     }
   }
 
-  private boolean checkAuthorization(RequesterIdentity requesterIdentity, 
RequestContext requestContext,
+  @VisibleForTesting
+  boolean checkAuthorization(RequesterIdentity requesterIdentity, 
RequestContext requestContext,
       HttpHeaders httpHeaders, QueryEnvironment.CompiledQuery compiledQuery) {
     Set<String> tables = compiledQuery.getTableNames();
     if (tables != null && !tables.isEmpty()) {
+      Set<String> tablesToAuthorize = new HashSet<>(tables);
+      for (String table : tables) {
+        String logicalTableName = _tableCache.getActualLogicalTableName(table);
+        if (logicalTableName != null) {
+          LogicalTableConfig config = 
_tableCache.getLogicalTableConfig(logicalTableName);
+          if (config != null) {
+            
tablesToAuthorize.addAll(config.getPhysicalTableConfigMap().keySet());
+          }
+        }
+      }
       TableAuthorizationResult tableAuthorizationResult =
-          hasTableAccess(requesterIdentity, tables, requestContext, 
httpHeaders);
+          hasTableAccess(requesterIdentity, tablesToAuthorize, requestContext, 
httpHeaders);

Review Comment:
   The worker plan scans the logical name, so a predicate keyed by a physical 
name would not reach that scan. In c714daa03e the broker checks the physical 
source policies before execution and server-side EXPLAIN, and declines the 
request when it cannot apply one. Tests cover both the configured and routed 
names.



-- 
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