Skip to content

Worker and batch diagnostics should sanitize raw exception messages outside MCP paths #3425

Description

@Widthdom

Found while dogfooding the current source with the locally built cdidx.

Several non-MCP diagnostic paths still pass raw exception messages across process or CLI boundaries. This is distinct from the existing MCP-tool error issue: these surfaces are symbol/hook worker responses, parent-side worker process failures, and batch query JSON parsing.

Evidence:

  • src/CodeIndex/Indexer/Symbols/SymbolExtractionWorker.cs returns worker errors using raw ex.Message and parent-side send/start/read errors include raw messages.
  • src/CodeIndex/Indexer/Hooks/PostExtractionHookCallbackWorker.cs has the same worker boundary pattern.
  • src/CodeIndex/Cli/QueryCommandRunner.cs batch JSON parse failures write raw JsonException.Message to stderr.

Suggested fix: route these diagnostics through the same bounded/sanitized error formatter used for other user-visible diagnostics, preserving safe failure categories such as worker_start_failed, worker_protocol_error, and invalid_batch_json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsecurity

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions