Aias00 opened a new issue, #6863:
URL: https://github.com/apache/shenyu/issues/6863

   ## Description
   `getRuleConditionList` (line 195) does 
`annotations.get(IngressConstants.PLUGIN_CONTEXT_PATH_PATH) + "/**"`. When the 
`shenyu.apache.org/plugin-context-path-path` annotation is absent (the common 
case — it is optional), `annotations.get()` returns null, and `null + "/**"` 
produces the string `"null/**"`. This string becomes the `paramValue` of a 
`ConditionData` with `PATH_PATTERN` operator, creating a rule that matches the 
literal path pattern "null/**". The same null is also set as 
`ruleHandle.contextPath` (line 172) and `ruleData.name` (line 180).
   
   ## Location
   - 
`shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/ContextPathParser.java:172,180,195`
   
   ## Impact
   Every ingress without the optional context-path annotation gets a 
context-path rule that matches path pattern "null/**" — a no-op rule that never 
fires for real traffic, but creates phantom selectors/rules in the gateway 
cache. If a request path ever starts with `null/`, the rule unexpectedly 
matches.
   
   ## Suggested fix
   Guard with `String contextPath = 
annotations.get(IngressConstants.PLUGIN_CONTEXT_PATH_PATH); if 
(Objects.isNull(contextPath)) { return res; }` (skip rule creation when no 
context path is configured), or use `Optional.ofNullable(...).orElse("")`.
   
   ## Related existing
   None — distinct from M-10 (which triggers it for dubbo/sofa); this is the 
null-concatenation defect in `ContextPathParser` itself, present even for 
divide ingresses without the annotation.
   


-- 
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