#6771·shenyu

[BUG] ModifyResponsePlugin always parses and re-serializes response body as JSON even for header-only configurations

Author: Aias00Created Aug 3, 2026Updated Sep 14, 2026
Labelstype: bugplugin: modify-responsepriority: medium
  • severity: Medium
  • files: shenyu-plugin/shenyu-plugin-modify-response/.../ModifyResponsePlugin.java:148-171
  • description: In writeWith, modifyBody(bytes) is unconditionally called regardless of whether any body modification rules are configured. JsonPath.parse(jsonValue) is always called and context.jsonString() always re-serializes. For non-JSON responses (XML, HTML, binary), JsonPath.parse throws → ShenyuException.
  • impact: (a) Non-JSON responses crash the plugin even when only header modifications are configured. (b) Re-serialization can change whitespace/key ordering for valid JSON.
  • suggested_fix: Short-circuit modifyBody when all body-key lists are empty/null; add a content-type guard.
  • confidence: Medium
  • related_existing: none

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