This is an automated email from the ASF dual-hosted git repository.

lizhimin pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 86bc27eb2 [ISSUE #5310] Fix admin tool queryMessage signature check 
failed (#5319)
86bc27eb2 is described below

commit 86bc27eb24c1a2b3a420b508c4681eef2feb63ad
Author: zhangjidi2016 <[email protected]>
AuthorDate: Fri Oct 28 14:26:28 2022 +0800

    [ISSUE #5310] Fix admin tool queryMessage signature check failed (#5319)
    
    * [ISSUE #5310] Fix admin tool queryMessage signature check failed
    
    * Compatible with versions less than 4.9.4
    
    Co-authored-by: zhangjidi <[email protected]>
---
 .../java/org/apache/rocketmq/acl/plain/PlainAccessResource.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java 
b/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java
index 305643e7a..1eeb0131f 100644
--- a/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java
+++ b/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java
@@ -43,6 +43,7 @@ import org.apache.rocketmq.acl.common.AuthenticationHeader;
 import org.apache.rocketmq.acl.common.AuthorizationHeader;
 import org.apache.rocketmq.acl.common.Permission;
 import org.apache.rocketmq.acl.common.SessionCredentials;
+import org.apache.rocketmq.common.MQVersion;
 import org.apache.rocketmq.common.MixAll;
 import org.apache.rocketmq.common.PlainAccessConfig;
 import org.apache.rocketmq.common.protocol.NamespaceUtil;
@@ -176,11 +177,14 @@ public class PlainAccessResource implements 
AccessResource {
         // Content
         SortedMap<String, String> map = new TreeMap<>();
         for (Map.Entry<String, String> entry : 
request.getExtFields().entrySet()) {
-            if (!SessionCredentials.SIGNATURE.equals(entry.getKey())
-                && !MixAll.UNIQUE_MSG_QUERY_FLAG.equals(entry.getKey())) {
+            if (!SessionCredentials.SIGNATURE.equals(entry.getKey())) {
                 map.put(entry.getKey(), entry.getValue());
             }
         }
+        if (request.getVersion() <= MQVersion.Version.V4_9_3.ordinal()
+            && map.containsKey(MixAll.UNIQUE_MSG_QUERY_FLAG)) {
+            map.remove(MixAll.UNIQUE_MSG_QUERY_FLAG);
+        }
         accessResource.setContent(AclUtils.combineRequestContent(request, 
map));
         return accessResource;
     }

Reply via email to