nacos-client, the default value of namespace set for naming and config is inconsistent, resulting in permission authentication failure #3525
Labels
kind/bug
Category issues or prs related to bug.
kind/discussion
Category issues related to discussion
Describe the bug
1)nacos-client
naming
进行服务注册,当namespace
没有指定,会默认为public,参考代码为:com.alibaba.nacos.client.naming.utils.InitUtils#initNamespaceForNaming
config
进行获取配置,当namespace
没有指定,会默认为空字符 "", 参考代码为:com.alibaba.nacos.client.utils.ParamUtil#parseNamespace
2)控制台新建权限
如果分配的资源为
public
,这时候数据表permissions
中的resource
字段就会为:*:*
,如果是分配其它自定义命名空间的资源就会为07ba088a-4782-468e-80cc-ee758beab327:*:*
3)com.alibaba.nacos.core.auth.AuthFilter权限拦截校验
如果是
config
请求,组装的权限resource
为:DEFAULT_GROUP:config/service-gateway
如果是
naming
请求,组装的权限resource
为public:DEFAULT_GROUP:naming/service-gateway
导致使用java.util.regex.Pattern#matches方法匹配权限, naming请求权限会不足
伪代码:
Expected behavior
希望能统一
nacos-client
的namespace
默认值;比如
config
在namespace
没有指定的情况下应该也默认为public
在新建资源的时候,当选择的资源为
public
的时候,resource
应为:public:*:*
Acutally behavior
How to Reproduce
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: