Skip to content

Commit c1aeca2

Browse files
authored
[#3942]If both acl and message trace are enabled and the default topic RMQ_SYS_TRACE_TOPIC is used for message trace, you don't need to add the PUB permission of RMQ_SYS_TRACE_TOPIC topic to the acl config. (#3943)
* If both acl and message trace are enabled and the default topic RMQ_SYS_TRACE_TOPIC is used for message trace, you don't need to add the PUB permission of RMQ_SYS_TRACE_TOPIC topic to the acl config. * Delete Chinese character in comments.
1 parent 03c5a3d commit c1aeca2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.apache.rocketmq.common.MixAll;
4747
import org.apache.rocketmq.common.PlainAccessConfig;
4848
import org.apache.rocketmq.common.constant.LoggerName;
49+
import org.apache.rocketmq.common.topic.TopicValidator;
4950
import org.apache.rocketmq.logging.InternalLogger;
5051
import org.apache.rocketmq.logging.InternalLoggerFactory;
5152
import org.apache.rocketmq.srvutil.AclFileWatchService;
@@ -664,8 +665,18 @@ public void validate(PlainAccessResource plainAccessResource) {
664665
if (!signature.equals(plainAccessResource.getSignature())) {
665666
throw new AclException(String.format("Check signature failed for accessKey=%s", plainAccessResource.getAccessKey()));
666667
}
667-
// Check perm of each resource
668668

669+
//Skip the topic RMQ_SYS_TRACE_TOPIC permission check,if the topic RMQ_SYS_TRACE_TOPIC is used for message trace
670+
Map<String, Byte> resourcePermMap = plainAccessResource.getResourcePermMap();
671+
if (resourcePermMap != null) {
672+
Byte permission = resourcePermMap.get(TopicValidator.RMQ_SYS_TRACE_TOPIC);
673+
if (permission != null && permission == Permission.PUB) {
674+
return;
675+
}
676+
}
677+
678+
679+
// Check perm of each resource
669680
checkPerm(plainAccessResource, ownedAccess);
670681
}
671682

0 commit comments

Comments
 (0)