jolshan commented on a change in pull request #9944: URL: https://github.com/apache/kafka/pull/9944#discussion_r655810138
########## File path: core/src/test/scala/integration/kafka/api/AuthorizerIntegrationTest.scala ########## @@ -746,7 +753,34 @@ class AuthorizerIntegrationTest extends BaseRequestTest { ApiKeys.DELETE_TOPICS -> deleteTopicsRequest ) - sendRequests(requestKeyToRequest) + sendRequests(requestKeyToRequest, true) + } + + /* + * even if the topic doesn't exist, request APIs should not leak the topic name + */ + @Test + def testAuthorizationWithTopicNotExisting(): Unit = { + val id = Uuid.randomUuid() + val topicNames = Map(id -> "topic") + val requestKeyToRequest = mutable.LinkedHashMap[ApiKeys, AbstractRequest]( + ApiKeys.METADATA -> createMetadataRequest(allowAutoTopicCreation = false), + ApiKeys.PRODUCE -> createProduceRequest, + ApiKeys.FETCH -> createFetchRequestWithUnknownTopic(id, ApiKeys.FETCH.latestVersion()), + ApiKeys.LIST_OFFSETS -> createListOffsetsRequest, + ApiKeys.OFFSET_COMMIT -> createOffsetCommitRequest, + ApiKeys.OFFSET_FETCH -> createOffsetFetchRequest, + ApiKeys.DELETE_TOPICS -> deleteTopicsRequest, + ApiKeys.DELETE_RECORDS -> deleteRecordsRequest, + ApiKeys.ADD_PARTITIONS_TO_TXN -> addPartitionsToTxnRequest, + ApiKeys.ADD_OFFSETS_TO_TXN -> addOffsetsToTxnRequest, + ApiKeys.CREATE_PARTITIONS -> createPartitionsRequest, + ApiKeys.DELETE_GROUPS -> deleteGroupsRequest, + ApiKeys.OFFSET_FOR_LEADER_EPOCH -> offsetsForLeaderEpochRequest, + ApiKeys.ELECT_LEADERS -> electLeadersRequest + ) + + sendRequests(requestKeyToRequest, false, topicNames) Review comment: I think because we still want to build the request. My understanding is that the topic is non-existing on the receiving side, but we still want to receive and handle the response. -- 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