Skip to content

[BUG] Data-handler removeRule guards on ruleData.getHandle(), leaking cache entries when handle is null at deletion time #6772

Closed

Description

@Aias00
  • severity: Medium
  • files: shenyu-plugin/shenyu-plugin-redirect/.../RedirectPluginDataHandler.java:49; .../shenyu-plugin-rewrite/.../RewritePluginDataHandler.java:49; .../shenyu-plugin-param-mapping/.../ParamMappingPluginDataHandler.java:49; .../shenyu-plugin-modify-response/.../ModifyResponsePluginDataHandler.java:49; .../shenyu-plugin-context-path/.../ContextPathPluginDataHandler.java:63
  • description: Five removeRule implementations guard removal with Optional.ofNullable(ruleData.getHandle()).ifPresent(...). If handle is null when the rule is deleted (deletion event carries only rule ID, or rule was previously updated to null handle), the cache entry keyed by selectorId_ruleId is never removed. RequestPluginHandler.removeRule and GeneralContextPluginDataHandler.removeRule correctly guard on ruleData itself.
  • impact: Stale rule-handle objects accumulate in cache indefinitely (memory leak + potential stale config reuse).
  • suggested_fix: Guard on Optional.ofNullable(ruleData) and always call removeHandle.
  • confidence: Medium
  • related_existing: none

Low


Identified during the 2026-08-02 deep re-scan; full list in docs/scan2-2026-08-02/06-medium-tiers.md.

Activity

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

    @github-actions
    Contributor

    👋 Hello @yuluo-yx

    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: redirectpriority: mediumtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions