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


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/access/BaseBasicAuthAccessControl.java:
##########
@@ -100,12 +104,20 @@ private void warnOnceAboutTableScope(P principal, String 
endpointUrl) {
 
   @Override
   public final boolean hasAccess(HttpHeaders httpHeaders, TargetType 
targetType, String targetId, String action) {
-    // Basic auth permissions are CRUD access types, not action names. 
AuthenticationFilter enforces the resolved
-    // AccessType before invoking this fine-grained check, so this overload 
must only prevent unauthenticated access.
-    // In particular it must not require unrestricted table scope for 
TargetType.CLUSTER: several table-scoped
-    // endpoints declare a cluster action, and for those the filter already 
resolved the table name and ran the
-    // table-scoped check above. Endpoints that name no table go through the 
cluster-wide check above instead.
-    return getPrincipal(httpHeaders).isPresent();
+    Optional<P> principal = getPrincipal(httpHeaders);
+    if (targetType == TargetType.CLUSTER && 
Actions.Cluster.CREATE_USER.equals(action)) {
+      return 
principal.filter(BaseBasicAuthAccessControl::canCreateUser).isPresent();
+    }
+    // AuthenticationFilter already checked CRUD and table scope, including 
for table requests with cluster actions.
+    return principal.isPresent();

Review Comment:
   Addressed in 68f60153ff. The same controller-admin check now covers account 
creation, updates, deletion, and writes to the account store. Batch writes and 
recursive deletes check their targets before the first change. File-backed 
Basic Auth retains its existing policy. All 22 focused tests passed locally.



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