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

femas-admin数据中包含注册中心的用户名和密码,存在安全风险 fix_issue#289 #290

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public PageService<NamespaceVo> namespaceToVo(PageService<Namespace> namespacePa
NamespaceVo vo = NamespaceVo.build(ns, registryConfigs);;
if(!CollectionUtil.isEmpty(ns.getRegistryId())){
for(String registryId : ns.getRegistryId()){
RegistryConfig config = registryManagerService.getConfigById(registryId);
RegistryConfig config = registryManagerService.getSafetyConfigById(registryId);
if(config != null){
registryConfigs.add(config);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public Result deleteRegistryCluster(String registryId) {

public Result<RegistryInfo> describeRegistryCluster(String registryId) {
RegistryInfo registryInfo = new RegistryInfo();
RegistryConfig config = getConfigById(registryId);
RegistryConfig config = getSafetyConfigById(registryId);
if (config == null) {
return Result.success();
}
Expand Down Expand Up @@ -291,7 +291,7 @@ public List<ServiceInstance> describeServiceInstance(String namespaceId, String
return instances;
}


//查询注册中心参数
public RegistryConfig getConfigById(String registryId) {
RegistryConfig config = registryConfigMapCache.get(registryId);
try {
Expand All @@ -304,6 +304,16 @@ public RegistryConfig getConfigById(String registryId) {
return config;
}

//查询去掉nacos用户名和密码的注册中心参数
public RegistryConfig getSafetyConfigById(String registryId) {
RegistryConfig config = getConfigById(registryId);
if (config != null) {
config.setUsername("");
config.setPassword("");
}
return config;
}

public boolean checkUrls(String urlsString) {
if (StringUtils.isEmpty(urlsString)) {
return false;
Expand Down