Skip to content

fix(tool_runner): avoid leaking tool exception details - #823

Closed
Bartok9 wants to merge 2 commits into
RobotecAI:bartok9/fixesfrom
Bartok9:salvage/tool-runner-cwe209-814
Closed

fix(tool_runner): avoid leaking tool exception details#823
Bartok9 wants to merge 2 commits into
RobotecAI:bartok9/fixesfrom
Bartok9:salvage/tool-runner-cwe209-814

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Salvage of fix(tool_runner): avoid leaking tool exception details to LLM (CWE-209) #814 by @sebastiondev (CWE-209: tool exception text leaked into ToolMessage returned to the LLM/user).
  • Keep full diagnostics server-side via logger.exception.
  • Return a generic message with tool name + exception class name only.
  • Value-add: offline regression tests that prove secret/host strings never appear in ToolMessage.content.

Credit

Original investigation, root-cause analysis, and fix approach by @sebastiondev in #814. This salvage rebases the intent onto current main and adds tests so the property stays locked.

Motivation

Tool failures from DB/HTTP/SSH libraries often embed hosts, paths, and credentials in str(e). Feeding that into ToolMessage.content surfaces internals to the LLM prompt and any conversation UI.

Verification

PYTHONPATH=src/rai_core python -m pytest tests/agents/langchain/test_tool_runner_cwe209.py -q
# 2 passed
  • Did NOT change: ValidationError branch, success path, multimodal artifact handling.

Notes for reviewers

Happy to close this in favor of #814 if preferred — the tests can be ported either direction.


Agent-Owner: sera · Platform: hermes · Claim-TTL: 24h

Salvage of RobotecAI#814 by @sebastiondev.

Exception messages raised by tool implementations were embeddedverbatim
into ToolMessage.content returned to the agent. Log full details via
logger.exception server-side and return only the tool name plus exception
class name to the LLM/user. Adds offline regression tests proving secrets
and hosts are not presented in ToolMessage content.

Signed-off-by: Bartok9 <danielrpike9@gmail.com>
@Bartok9 Bartok9 changed the title salvage: fix(tool_runner) avoid leaking tool exception details (credit @sebastiondev #814) fix(tool_runner): avoid leaking tool exception details (credit @sebastiondev #814) Jul 22, 2026
@maciejmajek
maciejmajek changed the base branch from main to bartok9/fixes July 22, 2026 10:04
@Bartok9 Bartok9 changed the title fix(tool_runner): avoid leaking tool exception details (credit @sebastiondev #814) fix(tool_runner): avoid leaking tool exception details Aug 7, 2026
@maciejmajek
maciejmajek deleted the branch RobotecAI:bartok9/fixes August 12, 2026 14:16
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.

2 participants