apollo icon indicating copy to clipboard operation
apollo copied to clipboard

通过Apollo open API操作key中包含“/”的配置,操作失败

Open rabbitgyk opened this issue 5 years ago • 12 comments

原因:

  1. client 中代码:String path = String.format("envs/%s/apps/%s/clusters/%s/namespaces/%s/items/%s", escapePath(env), escapePath(appId), escapePath(clusterName), escapePath(namespaceName), escapePath(itemDTO.getKey()));对key进行了转义;
  2. server 中代码:没有进行转义; 现象就是:获取配置、更新配置、删除配置报错。

rabbitgyk avatar Dec 28 '19 11:12 rabbitgyk

这个和服务端没有转义没有关系,在tomcat这一层就拦截了,详见org.apache.tomcat.util.buf. UDecoder.ALLOW_ENCODED_SLASH

另外spring security默认也会阻止这类参数,详见setAllowUrlEncodedSlash

nobodyiam avatar Dec 29 '19 07:12 nobodyiam

那我们是否考虑换一种请求参数传递方式,不使用这种path variable

rabbitgyk avatar Dec 30 '19 02:12 rabbitgyk

技术上是可以的,不过改接口的话,得考虑下向后兼容的问题,另外想问下什么样配置项是包含/的?

nobodyiam avatar Dec 31 '19 01:12 nobodyiam

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 29 '20 01:02 stale[bot]

我们有一些配置是针对前端接口的配置,配置的key的一部分是URL,比如:route.map./get/user/info

rabbitgyk avatar Mar 01 '20 08:03 rabbitgyk

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 30 '20 10:04 stale[bot]

遇到了同样的问题 如果通过yaml文件可以在bootstrap.yml定义成

openapi:
  allow:
    $[/sample-apollo/openapi/test]: ['10.10.21.43']

但是移动到apollo里面,并且改成了properties,就不会生效了,请问有什么好的办法可以解决?

谢谢

dragontree101 avatar May 03 '20 13:05 dragontree101

后面测试, 可以通过

openapi.allow."[/sample-apollo/openapi/test]"[0] = 127.0.0.1
openapi.allow."[/sample-apollo/openapi/test]"[1] = 127.0.0.2

方式进行设置。

dragontree101 avatar May 04 '20 01:05 dragontree101

@dragontree101 你好。请问这个设置方法具体怎么操作?用api操作怎么填参数?

DrmagicE avatar May 09 '20 09:05 DrmagicE

@dragontree101 你好。请问这个设置方法具体怎么操作?用api操作怎么填参数?

你好, 我们是在apollo后台配置进行操作的, 没有用过apollo的api进行参数设置

image

dragontree101 avatar May 11 '20 03:05 dragontree101

不考虑添加接口吗,因为界面上是可以设置key包含斜杆的

Cyril-hcj avatar Aug 14 '21 09:08 Cyril-hcj

这个问题还在跟进吗?

iceqing avatar Nov 15 '21 12:11 iceqing