You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/02/06 03:55:45 UTC
[GitHub] [dubbo] AlbumenJ commented on a change in pull request #9520: [dubbo-8601] Support Dynamic Token And add BroadCastTest
AlbumenJ commented on a change in pull request #9520:
URL: https://github.com/apache/dubbo/pull/9520#discussion_r800123134
##########
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.
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org