mirror of https://github.com/apache/kafka.git
Partially addresses KAFKA-15873. When filtering and sorting, we should be applying the filter before the sort of topics. Order that unauthorizedForDescribeTopicMetadata is added to not relevant as it is a HashSet. Reviewers: TaiJuWu <tjwu1217@gmail.com>, Calvin Liu <caliu@confluent.io>, Matthias J. Sax <matthias@confluent.io>
This commit is contained in:
parent
1ebca7817b
commit
d1a821226c
|
@ -89,7 +89,7 @@ public class DescribeTopicPartitionsRequestHandler {
|
|||
// Do not disclose the existence of topics unauthorized for Describe, so we've not even checked if they exist or not
|
||||
Set<DescribeTopicPartitionsResponseTopic> unauthorizedForDescribeTopicMetadata = new HashSet<>();
|
||||
|
||||
Stream<String> authorizedTopicsStream = topics.stream().sorted().filter(topicName -> {
|
||||
Stream<String> authorizedTopicsStream = topics.stream().filter(topicName -> {
|
||||
boolean isAuthorized = authHelper.authorize(
|
||||
abstractRequest.context(), DESCRIBE, TOPIC, topicName, true, true, 1);
|
||||
if (!fetchAllTopics && !isAuthorized) {
|
||||
|
@ -99,7 +99,7 @@ public class DescribeTopicPartitionsRequestHandler {
|
|||
);
|
||||
}
|
||||
return isAuthorized;
|
||||
});
|
||||
}).sorted();
|
||||
|
||||
DescribeTopicPartitionsResponseData response = metadataCache.describeTopicResponse(
|
||||
authorizedTopicsStream.iterator(),
|
||||
|
|
Loading…
Reference in New Issue