Skip to content

[BUG] GeneralContextPlugin NPE on null cached handle #6657

Description

@Aias00
  • severity: High
  • files: shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-general-context/src/main/java/org/apache/shenyu/plugin/general/context/GeneralContextPlugin.java:54
  • description: doExecute calls obtainHandle(CacheKeyUtils.INST.getKey(rule)) and immediately dereferences .isEmpty() without a null check. CommonHandleCache.obtainHandle returns null on cache miss. Every other plugin in this set (ContextPathPlugin:55, RewritePlugin:68, etc.) guards with Objects.isNull(handle) before use; GeneralContextPlugin is the sole exception.
  • impact: NullPointerException at runtime — request fails with 500 instead of passing through the chain.
  • suggested_fix: Add if (Objects.isNull(generalContextHandleMap) || generalContextHandleMap.isEmpty()) { return chain.execute(exchange); } before line 54.
  • confidence: High
  • related_existing: none

Identified during the 2026-08-02 deep re-scan; full list in docs/scan2-2026-08-02/00-consolidated-critical-high.md.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions