Vamsi-klu commented on code in PR #18975:
URL: https://github.com/apache/pinot/pull/18975#discussion_r3817442879


##########
pinot-core/src/main/java/org/apache/pinot/core/auth/BasicAuthPrincipal.java:
##########
@@ -62,6 +62,15 @@ public boolean hasTable(String tableName) {
     return isTableIncluded(tableName) && isTableNotExcluded(tableName);
   }
 
+  /// Returns whether this principal is scoped to every table, i.e. it carries 
neither an allow-list nor an
+  /// exclude-list. Access control implementations use this to decide requests 
that name no table, so the return value
+  /// must satisfy: `true` implies [#hasTable(String)] holds for every table 
name. A subclass that narrows table scope
+  /// by any other means — in particular by overriding [#hasTable(String)] — 
must override this method to match, or it
+  /// will report unrestricted scope while denying individual tables.
+  public boolean hasUnrestrictedTableAccess() {
+    return _tables.isEmpty() && _excludeTables.isEmpty();
+  }
+

Review Comment:
   Table lists are the signal on purpose. The static factory has no RoleType, 
and both controller factories share BaseBasicAuthAccessControl, so the cluster 
gate has to be something both understand. An ADMIN that also has an allow-list 
is still scoped. If we keyed off role, that user would get /users and the rest 
of the cluster while we were telling ourselves they were confined to a subset. 
Default bootstrap is fine (initUserACLConfig sets tables=null), so 
[RoleType.ADMIN](https://github.com/apache/pinot/pull/18975#) with no list 
still passes. I put that sentence on hasUnrestrictedTableAccess() and in the PR 
description.



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