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


##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BrokerRequestHandlerDelegate.java:
##########
@@ -216,14 +218,19 @@ public OptionalLong getRequestIdByClientId(String 
clientQueryId) {
     return 
_singleStageBrokerRequestHandler.getRequestIdByClientId(clientQueryId);
   }
 
-  private CursorResponse getCursorResponse(Integer numRows, BrokerResponse 
response)
+  private CursorResponse getCursorResponse(Integer numRows, BrokerResponse 
response, RequestContext requestContext)
       throws Exception {
     if (numRows == null) {
       throw new RuntimeException(
           "numRows not specified when requesting a cursor for request id: " + 
response.getRequestId());
     }
+    Set<String> authorizedLookupTables = 
requestContext.getAuthorizedLookupTables();
+    Set<String> subqueryTables = requestContext.getCursorSubqueryTables();
+    if (authorizedLookupTables == null || subqueryTables == null) {
+      throw QueryErrorCode.QUERY_VALIDATION.asException("Cursor authorization 
scope is unavailable");

Review Comment:
   [P1] Preserve cursor support with custom tracers
   
   Existing custom `RequestScope` implementations inherit `null` from both new 
getters, so this check rejects every newly requested cursor—even `SELECT 1`. 
The current StarTree `JFRTracer` is a concrete affected implementation: 
`PinotClientRequest` obtains its custom scope and passes it through this 
delegate. Track dependencies independently of tracer implementations, or 
coordinate updates to supported tracers before rollout. Keep the fail-closed 
check for stored cursors whose scope is genuinely unavailable.



##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BrokerRequestHandlerDelegate.java:
##########
@@ -216,14 +218,19 @@ public OptionalLong getRequestIdByClientId(String 
clientQueryId) {
     return 
_singleStageBrokerRequestHandler.getRequestIdByClientId(clientQueryId);
   }
 
-  private CursorResponse getCursorResponse(Integer numRows, BrokerResponse 
response)
+  private CursorResponse getCursorResponse(Integer numRows, BrokerResponse 
response, RequestContext requestContext)
       throws Exception {
     if (numRows == null) {
       throw new RuntimeException(
           "numRows not specified when requesting a cursor for request id: " + 
response.getRequestId());
     }
+    Set<String> authorizedLookupTables = 
requestContext.getAuthorizedLookupTables();
+    Set<String> subqueryTables = requestContext.getCursorSubqueryTables();

Review Comment:
   [P1] Preserve multi-stage subquery dependencies
   
   MSE `runIdSetSubquery()` creates a separate `DefaultRequestContext` and 
returns only the serialized IdSet. Its tables never reach the outer context, 
whose empty dependency sets are accepted here. For example, with `SELECT 
COUNT(*) FROM a WHERE IN_SUBQUERY(col1, 'SELECT IDSET(col1) FROM b') = 1`, a 
reader authorized for `a` but denied `b` can fetch stored results derived from 
`b`. Propagate completed MSE subquery tables and nested dependencies into the 
parent context, and test fetch denial for an unauthorized inner table. This 
confirms the existing unresolved review thread.



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