nonehat opened a new issue #2591:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2591


   serviceComb里获取URI的方式是 io.vertx.core.http.HttpServerRequest.path() —— 
而该种方式获取到的URI是未经归一化的。即,r若请求的URI为经过构建的畸形URI,如/cloud/api/v2/aaaa//////././../bbbb/../cccc,request.path()获取到的是原始值/cloud/api/v2/aaaa//////././../bbbb/../cccc,而非归一化之后的URI
  /cloud/api/v2/aaaa/cccc。
   
   request.path() 获取到的URI作为访问控制的依据时会出现安全漏洞。例如,如下代码本意对 /cloud/api/v2/getFlag 
需要鉴权而后返回falg。
   // Filter代码
   if (request.path().equals("/cloud/api/v2/getFlag")) {
       // 鉴权代码
   } 
   
   // 业务代码
   @RequstMapping("/cloud/api/v2/getFlag")
   public String flag() {
       return "congrats_this_is_the_flag_4_u";
   }
   
   但是可以绕过鉴权获取flag:当请求URI为 
/cloud/api/v2///////getFlag是可以绕过鉴权,但是又可以将请求路由到flag()函数返回flag。
   
   搜索serviceComb API之后未找到可以获取归一化URI/URL的API,而在Spring框架中存在类似的API:
   String uri = request.getContextPath() + request.getServletPath() + 
request.getPathInfo();
   
   **希望serviceComb可以实现类似功能的API,避免开发人员在关键场景误用path()导致安全漏洞。**


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to