Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#2619·rig

bug: tool arguments are written to DEBUG logs during dispatch

Author: dafyy321-pixelCreated Sep 28, 2026Updated Sep 28, 2026
  • I have looked for existing issues (including closed) about this

Bug Report

The shared tool dispatcher writes the complete argument string to a rig DEBUG event immediately before a registered tool runs. Tool inputs often contain values that are useful to the tool but should not be copied to a logging system: API tokens, customer records, document excerpts, or data returned by a previous tool. An application can therefore expose those values simply by enabling rig=debug while troubleshooting an unrelated problem.

The event comes from execute_tool in crates/rig-agent/src/tool/registry.rs. That function is shared by ToolSet, ToolCatalog, and ToolServer, so the behavior is present across the usual dispatch paths. The tool receives the arguments as intended; the unexpected side effect is the extra copy in the tracing output.

Reproduction

  1. Configure a tracing subscriber that captures the rig target at DEBUG level. The usual RUST_LOG=rig=debug setting is enough when the application uses an environment-filtered subscriber.
  2. Register a tool such as echo and dispatch it with a distinctive JSON value, for example {"token":"canary-secret-123"}. The value can be a harmless canary; no actual credential is needed for the reproduction.
  3. Inspect the captured event from the dispatch call. The event identifies echo through tool_name, but its message also contains calling tool with args: and the complete JSON string, including canary-secret-123.

The result does not depend on the tool echoing its input or logging anything itself. The value is written before echo executes, so the tool's own logging policy cannot suppress this dispatch event. It also does not depend on a particular provider: the event is in the local registry path that invokes registered tools.

The relevant call is:

rust
tracing::debug!(target: "rig", tool_name = name, "calling tool with args:\n{args}");

This can be reproduced with an in-process tracing subscriber; no provider account or network request is needed. The argument value appears in the captured event fields even when the application itself never logs it.

For comparison, the same DEBUG event would still be useful if it recorded calling tool and tool_name=echo alone. The tool name is enough to identify where the dispatcher routed the call; serializing the full payload provides no additional routing information.

Expected behavior

Keep an event that identifies the called tool, including its tool_name, without including raw argument values in the event message or fields. The original argument string must still be passed unchanged to the tool, and the tool result should be unaffected.

Screenshots

Not applicable; the observable output is a text log event.

Additional context

DEBUG logging is often enabled temporarily in development, but production troubleshooting may also forward it to centralized collectors and retain it beyond the lifetime of the request. Removing the argument value at the shared dispatch point addresses all callers of that function and avoids requiring every registered tool to work around a log emitted before it runs.

This is especially easy to overlook because the event is at DEBUG level and a short local run may use only harmless arguments. The exposure appears when an application uses the same setting while processing real requests. The expected fix is limited to the dispatch event: callers should still be able to pass arbitrary valid argument strings to tools, and tool authors remain responsible for any logging they choose to add inside their own implementations.

Source: 0xPlaygrounds/rig

View original on GitHubView discussion on GitHub