pprovenzano commented on code in PR #14083:
URL: https://github.com/apache/kafka/pull/14083#discussion_r1298770601


##########
core/src/main/scala/kafka/server/ControllerApis.scala:
##########
@@ -842,6 +848,114 @@ class ControllerApis(val requestChannel: RequestChannel,
       }
   }
 
+  def allowTokenRequests(request: RequestChannel.Request): Boolean = {
+    val protocol = request.context.securityProtocol
+    if (request.context.principal.tokenAuthenticated ||
+      // We allow forwarded requests to use PLAINTEXT for testing purposes
+      (request.isForwarded == false && protocol == SecurityProtocol.PLAINTEXT) 
||
+      // disallow requests from 1-way SSL
+      (protocol == SecurityProtocol.SSL && request.context.principal == 
KafkaPrincipal.ANONYMOUS))
+      false
+    else
+      true
+  }

Review Comment:
   Yes, I agree that special casing PLAINTEXT is generally bad, and no 
production system should ever have PLAINTEXT. Here I am doing just what you 
suggested, I'm only allowing it on the forwarded cases and really that should 
only ever be on non production systems used for testing. The other checks still 
should not be allowed on the forwarded anyway. 



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to