Skip to content

Commit 91fdc35

Browse files
Fix the permission check for retry topic to get topic route. (#9073)
1 parent 16b6e53 commit 91fdc35

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,13 @@ public List<DefaultAuthorizationContext> build(ChannelHandlerContext context, Re
182182
Resource group;
183183
switch (command.getCode()) {
184184
case RequestCode.GET_ROUTEINFO_BY_TOPIC:
185-
topic = Resource.ofTopic(fields.get(TOPIC));
186-
result.add(DefaultAuthorizationContext.of(subject, topic, Arrays.asList(Action.PUB, Action.SUB, Action.GET), sourceIp));
185+
if (NamespaceUtil.isRetryTopic(fields.get(TOPIC))) {
186+
group = Resource.ofGroup(fields.get(TOPIC));
187+
result.add(DefaultAuthorizationContext.of(subject, group, Arrays.asList(Action.SUB, Action.GET), sourceIp));
188+
} else {
189+
topic = Resource.ofTopic(fields.get(TOPIC));
190+
result.add(DefaultAuthorizationContext.of(subject, topic, Arrays.asList(Action.PUB, Action.SUB, Action.GET), sourceIp));
191+
}
187192
break;
188193
case RequestCode.SEND_MESSAGE:
189194
if (NamespaceUtil.isRetryTopic(fields.get(TOPIC))) {

0 commit comments

Comments
 (0)