Skip to content

Commit fb6c693

Browse files
committed
KAFKA-17601: Inter-broker connections do not expose their clientSoftwareName and clientSoftwareVersion tags
Signed-off-by: PoAn Yang <[email protected]>
1 parent 615f1a0 commit fb6c693

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Diff for: clients/src/main/java/org/apache/kafka/common/requests/RequestContext.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ public class RequestContext implements AuthorizableRequestContext {
4141
public final KafkaPrincipal principal;
4242
public final ListenerName listenerName;
4343
public final SecurityProtocol securityProtocol;
44-
public final ClientInformation clientInformation;
44+
// The client information can be updated if the request is ApiVersionRequest,
45+
// so the client information will not be unknown for ApiVersionRequest.
46+
public ClientInformation clientInformation;
4547
public final boolean fromPrivilegedListener;
4648
public final Optional<KafkaPrincipalSerde> principalSerde;
4749

Diff for: core/src/main/scala/kafka/network/SocketServer.scala

+1
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,7 @@ private[kafka] class Processor(
11451145
channel.channelMetadataRegistry.registerClientInformation(new ClientInformation(
11461146
apiVersionsRequest.data.clientSoftwareName,
11471147
apiVersionsRequest.data.clientSoftwareVersion))
1148+
context.clientInformation = channel.channelMetadataRegistry.clientInformation
11481149
}
11491150
}
11501151
requestChannel.sendRequest(req)

Diff for: core/src/test/scala/unit/kafka/network/SocketServerTest.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ class SocketServerTest {
274274
sendRequest(plainSocket, apiVersionRequestBytes(clientId, version))
275275
var receivedReq = receiveRequest(server.dataPlaneRequestChannel)
276276

277-
assertEquals(ClientInformation.UNKNOWN_NAME_OR_VERSION, receivedReq.context.clientInformation.softwareName)
278-
assertEquals(ClientInformation.UNKNOWN_NAME_OR_VERSION, receivedReq.context.clientInformation.softwareVersion)
277+
assertEquals(expectedClientSoftwareName, receivedReq.context.clientInformation.softwareName)
278+
assertEquals(expectedClientSoftwareVersion, receivedReq.context.clientInformation.softwareVersion)
279279

280280
server.dataPlaneRequestChannel.sendNoOpResponse(receivedReq)
281281

0 commit comments

Comments
 (0)