BobSong-dev opened a new pull request, #7549:
URL: https://github.com/apache/shenyu/pull/7549

   ## Background
   
   An MCP tool can return the same data in structuredContent and JSON text 
blocks. Deleting only the structured field leaves its copies visible. This adds 
an opt-in, per-tool field-removal policy to Agent Gateway's existing tools-only 
path.
   
   ## Changes
   
   - Add `mcp.structuredContentRemovals`, keyed by exact allowed tool names, 
with shared Admin/gateway validation and immutable request snapshots.
   - Delete configured object fields on a private result copy after 
authorization and tool execution, before JSON/SSE encoding.
   - For active policies, accept only a structured object and complete 
strict-JSON text copies equal to that object; rebuild each copy after deletion. 
Reject unverifiable text, media, nonempty metadata and unknown extensions.
   - Preserve advertised outputSchema and validate the filtered object using a 
bounded, reference-free Draft 2020-12 subset. Rejection returns HTTP 502 / 
JSON-RPC -32024 without raw-result fallback or tool retry.
   - Keep disabled/unconfigured tools unchanged; document limits and add 
configuration, schema, copy-safety, isolation and protocol regressions. Add the 
Networknt 2.0.0 validator dependency to this module; its Apache 2.0 license is 
already listed in the bootstrap distribution.
   
   This handles declared fields and verified result copies, not arbitrary 
sensitive-value detection or global log redaction. Field mapping, Token 
accounting, model fallback, prompts and resources are out of scope.
   
   ## Verification
   
   - Final tree based on master `5961490ff`: targeted Windows/JDK 17, 45-module 
clean verify — 617 tests / 34 suites; zero failures, errors or skips; 
Checkstyle and RAT passed.
   - Earlier feature baseline `ad386882a`: Windows 610 tests; RISC-V/QEMU 
14-module clean verify 553 tests / 31 suites; zero failures, errors or skips, 
Checkstyle and RAT passed.
   - On that earlier baseline, real local Admin/H2 → WebSocket → Bootstrap 
validation passed 43 checks with synthetic local/remote tools, including 
JSON/SSE copy removal, unsafe-result rejection, schema preservation, hot 
updates, authorization, cancellation and concurrent same-id isolation.
   - The committed Git tree is identical to the tested final-master candidate; 
`git diff --check` passed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to