Skip to content

fix(mcp): sanitize JSON-RPC error responses#1220

Merged
chaliy merged 2 commits intomainfrom
fix/1182-sanitize-jsonrpc-errors
Apr 11, 2026
Merged

fix(mcp): sanitize JSON-RPC error responses#1220
chaliy merged 2 commits intomainfrom
fix/1182-sanitize-jsonrpc-errors

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 11, 2026

Summary

Closes #1182

  • Replace raw serde_json error details in JSON-RPC parse error responses with generic "Parse error: invalid JSON"
  • Replace raw serde field/struct names in invalid arguments errors with generic "Invalid arguments"
  • Full error details logged to stderr for operator debugging
  • Execution errors in ToolResult left as-is (LLM needs error context)

Test plan

  • test_parse_error_does_not_leak_internal_details — malformed JSON returns generic error
  • test_invalid_arguments_does_not_leak_struct_names — wrong fields return generic error
  • All 34 tests pass

chaliy added 2 commits April 11, 2026 17:30
…akage

Replace raw serde_json error details in JSON-RPC error responses with
generic messages. Internal details (struct names, field names, line/column
numbers) are now logged to stderr for operator debugging but never sent
to the client.

Closes #1182
@chaliy chaliy merged commit fda250f into main Apr 11, 2026
11 checks passed
@chaliy chaliy deleted the fix/1182-sanitize-jsonrpc-errors branch April 11, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sec(mcp): JSON-RPC error responses leak internal error details

1 participant