Skip to content

[BUG] GeneralContextPlugin NPE on null cached handle #6657

Closed

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.

Activity

  1. added
    type: bug
    priority: high
    on Aug 3, 2026
  2. github-actions commented on Aug 3, 2026

    @github-actions
    Contributor

    👋 Hello @Aias00

    A new issue has been opened by @Aias00:

    Please review when you have time. Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: generalContextpriority: hightype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions