apache / apache/shenyu

[BUG] IngressParser contextPathParse condition uses || instead of && — runs for dubbo/sofa ingresses

Open
#6,862 2 comments 0 reactions 1 assignee Claimed by @yykaue View on GitHub
kubernetes priority: medium type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
Line 75: `if (!dubboEnabled || !sofaEnabled)` calls `contextPathParse` whenever at least one of dubbo/sofa is disabled. Since dubbo and sofa are mutually exclusive (the if/else chain on lines 78–93 picks at most one), this condition is true for **every** ingress — including dubbo-only and sofa-only ingresses. The intent is `!dubboEnabled && !sofaEnabled` (run `contextPathParse` only when neither RPC plugin is enabled, i.e. for HTTP-based plugins). With `||`, `contextPathParse` runs for dubbo/sofa ingresses, adding a `ContextPathParser` `ShenyuMemoryConfig` alongside the `DubboIngressParser`/`SofaParser` one, creating duplicate context-path selectors.

## Location
- `shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java:75`

## Impact
Dubbo/Sofa ingresses get spurious context-path-plugin selectors with null/`"null/**"` rule conditions (see M-11), polluting the selector cache and potentially causing routing ambiguity.

## Suggested fix
Change `||` to `&&`.

## Related existing
None — GOV-T6 (#6679) covers parser zero-tests; this is a logic operator defect.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.