fix: stop leaking exception messages to clients via JSON-RPC error data - #486
Merged
koic merged 1 commit intoAug 7, 2026
Merged
Conversation
jj-ivx
marked this pull request as ready for review
August 6, 2026 15:56
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>
jj-ivx
force-pushed
the
sanitize-tool-error-messages
branch
from
August 6, 2026 16:28
c6b475d to
f379e13
Compare
Member
|
For context, this behavior was originally introduced in #194 to improve the developer experience. That said, I think this change is appropriate now. Exposing the message could be made opt-in through configuration for development purposes, but that can be addressed separately if the need arises. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unexpected exceptions raised by tool handlers — and anything reaching
JsonRpcHandler's blindrescue StandardError— had their#messageechoed verbatim into the JSON-RPC errordatamember, exposing internals such as class, method and host names to untrusted clients (CWE-209).Server#call_toolno longer appendse.messageto the wrappedRequestHandlerError; clients see"Internal error calling tool <name>". Observability is unaffected: the original exception still reachesconfiguration.exception_reporterviaoriginal_error.JsonRpcHandler.process_request's genericrescue StandardErrorno longer setsdata(JSON-RPC 2.0 makes it optional)."Server does not support ...") by re-raising throughRequestHandlerError— the one channel whose message is deliberately surfaced to clients.Fixes #485
🤖 Generated with Claude Code