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.
Description
Each plugin's
doExecutecallsCACHED_HANDLE.get().obtainHandle(key)and immediately dereferences the result without a null check.CommonHandleCache.obtainHandle(key)returnscached.get(key)which isnullon cache miss. The cache miss occurs when a rule is created with a null/emptyhandlefield — every data handler guards the cache write withOptional.ofNullable(ruleData.getHandle()).ifPresent(...), so a rule with no handle JSON is never cached but CAN still be matched byAbstractShenyuPlugin.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-60shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-resilience4j/src/main/java/org/apache/shenyu/plugin/resilience4j/Resilience4JPlugin.java:66-67shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-sentinel/src/main/java/org/apache/shenyu/plugin/sentinel/SentinelPlugin.java:59-60shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/RateLimiterPlugin.java:72-74shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/cache/CommonHandleCache.java:42-44Impact
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 inContextPathPluginandMockPlugin(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 separatedoExecuteimplementations, all of which lack the guard that #6657 added forGeneralContextPluginonly.