complone commented on a change in pull request #9520:
URL: https://github.com/apache/dubbo/pull/9520#discussion_r814421700



##########
File path: 
dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/TokenFilter.java
##########
@@ -47,10 +47,14 @@ public Result invoke(Invoker<?> invoker, Invocation inv)
             Class<?> serviceType = invoker.getInterface();
             Map<String, Object> attachments = inv.getObjectAttachments();
             String remoteToken = (attachments == null ? null : (String) 
attachments.get(TOKEN_KEY));
-            if (!token.equals(remoteToken)) {
-                throw new RpcException("Invalid token! Forbid invoke remote 
service " + serviceType + " method " + inv.getMethodName() +
-                        "() from consumer " + 
RpcContext.getServiceContext().getRemoteHost() + " to provider " +
-                        RpcContext.getServiceContext().getLocalHost()+ ", 
consumer incorrect token is " + remoteToken);
+            if (ConfigUtils.isDefault(token)){
+                inv.setAttachment(TOKEN_KEY,token);
+            }
+            if (!token.equals(remoteToken) && !ConfigUtils.isDefault(token)) {

Review comment:
       > This may cause token downgrade attack. If provider use default token, 
TokenFilter in provider side may not work.
   
   @AlbumenJ You mean that when the token is passed in the thread context it 
should fake a value, or expose a configuration. Is it used to guarantee 
idempotency when downgrading?




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to