AndrewJSchofield commented on code in PR #24355:
URL: https://github.com/apache/kafka/pull/24355#discussion_r4723520726


##########
clients/src/main/java/org/apache/kafka/common/security/authenticator/SaslServerAuthenticator.java:
##########
@@ -442,6 +445,10 @@ private void handleSaslToken(byte[] clientToken) throws 
IOException {
             ByteBuffer requestBuffer = ByteBuffer.wrap(clientToken);
             RequestHeader header = RequestHeader.parse(requestBuffer);
             ApiKeys apiKey = header.apiKey();
+            if (apiKey == ApiKeys.SASL_AUTHENTICATE && 
header.isApiVersionSupported()
+                    && !apiKey.isVersionEnabled(header.apiVersion(), 
enableUnstableLastVersion))
+                throw new InvalidRequestException("Received request for 
disabled api with key " + apiKey.id + " (" +

Review Comment:
   `UnsupportedVersionException` seems better here.



##########
clients/src/main/java/org/apache/kafka/common/security/authenticator/SaslServerAuthenticator.java:
##########
@@ -442,6 +445,10 @@ private void handleSaslToken(byte[] clientToken) throws 
IOException {
             ByteBuffer requestBuffer = ByteBuffer.wrap(clientToken);
             RequestHeader header = RequestHeader.parse(requestBuffer);
             ApiKeys apiKey = header.apiKey();
+            if (apiKey == ApiKeys.SASL_AUTHENTICATE && 
header.isApiVersionSupported()

Review Comment:
   That does of course mean that it will parse the request. An unstable request 
version would be parseable I think.



##########
clients/src/main/java/org/apache/kafka/common/security/authenticator/SaslServerAuthenticator.java:
##########
@@ -442,6 +445,10 @@ private void handleSaslToken(byte[] clientToken) throws 
IOException {
             ByteBuffer requestBuffer = ByteBuffer.wrap(clientToken);
             RequestHeader header = RequestHeader.parse(requestBuffer);
             ApiKeys apiKey = header.apiKey();
+            if (apiKey == ApiKeys.SASL_AUTHENTICATE && 
header.isApiVersionSupported()

Review Comment:
   nit: Let's put this test after the `apiKey != ApiKeys.SASL_AUTHENTICATE` 
below.



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

Reply via email to