[BUG] AbstractNodeDataChangedListener.onSelectorChanged builds config-key prefix with raw getNamespaceId() (no SYS_DEFAULT fallback) — selectors invisible when namespaceId null
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
## Description
Each plugin's `doExecute` calls `CACHED_HANDLE.get().obtainHandle(key)` and immediately dereferences the result without a null check. `CommonHandleCache.obtainHandle(key)` returns `cached.get(key)` which is `null` on cache miss. The cache miss occurs when a rule is created with a null/empty `handle` field — every data handler guards the cache write with `Optional.ofNullable(ruleData.getHandle()).ifPresent(...)`, so a rule with no handle JSON is never cached but CAN still be matched by `AbstractShenyuPlugin.execute` (matching is condition-based, not handle-based).
## Location
- `shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/HystrixPlugin.java:59-60`
- `shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-resilience4j/src/main/java/org/apache/shenyu/plugin/resilience4j/Resilience4JPlugin.java:66-67`
- `shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-sentinel/src/main/java/org/apache/shenyu/plugin/sentinel/SentinelPlugin.java:59-60`
- `shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/RateLimiterPlugin.java:72-74`
- `shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/cache/CommonHandleCache.java:42-44`
## Impact
Every request matching a rule that was created without a handle (or whose handle was cleared) receives an unhandled `NullPointerException` / 500. A single misconfigured rule takes down all traffic matching it.
## Suggested fix
Add a null guard at the top of each `doExecute`, e.g. `if (Objects.isNull(handle)) { return chain.execute(exchange); }`, mirroring the guard added in `ContextPathPlugin` and `MockPlugin` (line 52-54).
## Related existing
Distinct from #6657 (GeneralContextPlugin NPE) — that issue was filed only for `GeneralContextPlugin.java:54`. These are four separate plugins with separate caches and separate `doExecute` implementations, all of which lack the guard that #6657 added for `GeneralContextPlugin` only.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with CommonHandleCache.java and inspect the doExecute methods in HystrixPlugin.java, Resilience4JPlugin.java, SentinelPlugin.java, and RateLimiterPlugin.java. Compare their handling with ContextPathPlugin and MockPlugin, then verify that rules without a handle no longer produce an unhandled exception and that matching requests continue through the chain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100