dajac commented on a change in pull request #9103:
URL: https://github.com/apache/kafka/pull/9103#discussion_r465908873



##########
File path: core/src/main/scala/kafka/server/KafkaApis.scala
##########
@@ -2982,12 +3089,33 @@ class KafkaApis(val requestChannel: RequestChannel,
                                 logIfDenied: Boolean = true,
                                 refCount: Int = 1): Boolean = {
     authorizer.forall { authZ =>
-      val resource = new ResourcePattern(resourceType, resourceName, 
PatternType.LITERAL)
-      val actions = Collections.singletonList(new Action(operation, resource, 
refCount, logIfAllowed, logIfDenied))
-      authZ.authorize(requestContext, actions).get(0) == 
AuthorizationResult.ALLOWED
+      if (authorizeAction(requestContext, operation,
+        resourceType, resourceName, logIfAllowed, logIfDenied, refCount, 
authZ)) {
+        true
+      } else {
+        operation match {
+          case ALTER | ALTER_CONFIGS | CREATE | DELETE =>
+            requestContext.maybeFromControlPlane &&
+              authorizeAction(requestContext, CLUSTER_ACTION,
+                resourceType, resourceName, logIfAllowed, logIfDenied, 
refCount, authZ)

Review comment:
       I wonder if this is correct. Usually, we use `CLUSTER_ACTION` action 
with the `CLUSTER` resource. For instance, this is how we authorize control 
requests:
   ```
   authorize(request.context, CLUSTER_ACTION, CLUSTER, CLUSTER_NAME)
   ```
   I thought that we would do the same in this case. Don't we?




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to