fix: stop leaking exception messages to clients via JSON-RPC error data

Tool handler exceptions and anything reaching JsonRpcHandler's blind
rescue had their #message echoed into the error data member, exposing
internals to untrusted clients (CWE-209). Capability errors keep their
client-facing message by re-raising through RequestHandlerError, the
one channel whose message is deliberately surfaced.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Joshua J 2026-08-06 17:47:56 +02:00
commit f379e13b47
No known key found for this signature in database

View file

@ -310,7 +310,6 @@ describe JsonRpcHandler do
assert_rpc_error expected_error: {
code: -32603,
message: "Internal error",
data: "Something bad happened",
}
assert_equal 1, @response[:id]
assert_nil @response[:result]
@ -452,7 +451,6 @@ describe JsonRpcHandler do
assert_rpc_error expected_error: {
code: -32603,
message: "Internal error",
data: "Something bad happened",
}
end