rondagostino commented on code in PR #14083: URL: https://github.com/apache/kafka/pull/14083#discussion_r1298734803
########## 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: Special-casing for PLAINTEXT, etc -- smells pretty bad. I'm thinking the appropriate check here is just whether the request is forwarded or not. Given that it takes cluster privileges to send an envelope request, we can trust the broker to perform these checks. The controllers could conceivably be within some private network that only the brokers have access to, for example, in that case who knows what the authentication between broker and controller looks like. -- 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