Skip to content

Fix #2131: strip anyhow chain from robot JSON error output#900

Open
AlexMikhalev wants to merge 1 commit into
mainfrom
task/2131-fix-anyhow-chain-disclosure
Open

Fix #2131: strip anyhow chain from robot JSON error output#900
AlexMikhalev wants to merge 1 commit into
mainfrom
task/2131-fix-anyhow-chain-disclosure

Conversation

@AlexMikhalev
Copy link
Copy Markdown
Contributor

Summary

Security sentinel (P2, 2026-06-04, PR #2129 review) flagged anyhow chain disclosure in robot-mode JSON error output.

  • format!("{:#}", err) in emit_robot_error_and_exit rendered the full anyhow chain into stdout JSON
  • Changed to format!("{}", err) — outermost message only, no chain leakage
  • eprintln!("Error: {:#}", err) on stderr is unchanged (developer-facing)

One-line change in crates/terraphim_agent/src/main.rs:1322.

Closes terraphim/terraphim-ai#2131 (Gitea issue)

Test plan

  • cargo check -p terraphim_agent passes
  • cargo fmt -p terraphim_agent -- --check passes
  • cargo clippy -p terraphim_agent passes
  • cargo test -p terraphim_agent passes (running)

@adf:quality-coordinator please review this security fix.

…2131

format!("{:#}", err) renders the full anyhow chain
(e.g. "outer: middle: db.internal:5432") into the
robot-mode JSON response printed to stdout, potentially
leaking internal implementation details to callers.

Change to format!("{}", err) which renders only the
outermost message.  The stderr eprintln! keeps {:#}
since that output is developer-facing, not API-facing.

P2 finding from security sentinel review of PR #2129.
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.

1 participant