Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dubbo-registry-nacos use securityKey contains special char #7363

Closed
2 tasks done
shalk opened this issue Mar 12, 2021 · 1 comment
Closed
2 tasks done

dubbo-registry-nacos use securityKey contains special char #7363

shalk opened this issue Mar 12, 2021 · 1 comment
Labels
help wanted Everything needs help from contributors

Comments

@shalk
Copy link

shalk commented Mar 12, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.9, 2.7.8
  • Operating System version: xxx
  • Java version: 1.8

Steps to reproduce this issue

I have accessKey and secretKey for nacos. when i use nacos directly , everything is ok.
But when i config accessKey in RegistryConfig,exception will throw

  • How can i config secretKey contains "+" or "/" ?
  • NacosRegistryFactory resolve the url to create NamingService, how to hidden secretKey in url on registry ?
package com.example.dubbo;

import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;

import java.util.HashMap;
import java.util.concurrent.CountDownLatch;

public class Server {
    public static void main(String[] args) throws InterruptedException {
        ServiceConfig<EchoService> config = new ServiceConfig<>();

        config.setApplication(new ApplicationConfig("provider-1"));

        ProtocolConfig protocolConfig = new ProtocolConfig();
        protocolConfig.setName("dubbo");
        protocolConfig.setPort(12345);

        config.setProtocol(protocolConfig);

        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress("nacos://1.1.1.1");

        HashMap<String, String> paramMap = new HashMap<>();
        paramMap.put("namespace","MyNameSpace");
        paramMap.put("accessKey","AAAA");
        paramMap.put("secretKey","e3xP1NQU7hjD6PcXBb+jCSjs4p2iLq/w");
        registryConfig.setParameters(paramMap);
    
    
        config.setRegistry(registryConfig);

        config.setInterface(EchoService.class);
        config.setRef(new EchoServiceImpl());
        config.export();

        new CountDownLatch(1).await();
    }
}

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

What do you expected from the above steps?

  • my service will registry on nacos though secretKey contains "+" or "/" ?

  • securtyKey should be hidden on url

Actual Result

What actually happens?

exception throw, and securtyKey is print on log.

If there is an exception, please attach the exception trace:

Exception in thread "main" java.lang.IllegalStateException: Invalid secretKey="e3xP1NQU7hjD6PcXBb+jCSjs4p2iLq/w" contains illegal character, only digit, letter, '-', '_' or '.' is legal.
	at org.apache.dubbo.config.utils.ConfigValidationUtils.checkProperty(ConfigValidationUtils.java:642)
	at org.apache.dubbo.config.utils.ConfigValidationUtils.checkNameHasSymbol(ConfigValidationUtils.java:602)
	at org.apache.dubbo.config.utils.ConfigValidationUtils.checkParameterName(ConfigValidationUtils.java:627)
	at org.apache.dubbo.config.utils.ConfigValidationUtils.validateRegistryConfig(ConfigValidationUtils.java:515)
	at org.apache.dubbo.config.utils.ConfigValidationUtils.validateServiceConfig(ConfigValidationUtils.java:357)
	at org.apache.dubbo.config.ServiceConfig.checkAndUpdateSubConfigs(ServiceConfig.java:289)
	at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:190)
	at com.example.dubbo.Server.main(Server.java:45)
@AlbumenJ
Copy link
Member

close #7363 via #7371, you can use ignoreCheckKeys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Everything needs help from contributors
Projects
None yet
Development

No branches or pull requests

2 participants