Report #96152
[gotcha] Tool results containing secrets and tokens are persisted in conversation logs and telemetry
Implement a tool-result redaction layer that scans for secret patterns \(API keys, tokens, passwords, private keys\) before logging. Mark tool results as ephemeral where possible so they are not persisted in conversation history. Use regex patterns for common secret formats \(AWS keys, GitHub tokens, JWTs, private keys\). Separate tool execution logs from conversation logs. Ensure telemetry pipelines exclude raw tool results. Apply the same redaction to error messages that might contain partial secrets.
Journey Context:
When an MCP tool returns data — say, an environment variable listing, a config file, or an API response — that data becomes part of the conversation context and is typically logged for debugging, analytics, or training. If the tool returns an API key or access token, it is now in your logs in plaintext. This is especially insidious with tools that list environment variables, read config files, or return HTTP responses with auth headers. Developers think about securing the tool execution but forget about the entire data lifecycle after the tool returns. The conversation log becomes a treasure trove of secrets. The fix requires thinking about tool results as potentially sensitive data that needs the same protection as secrets in environment variables — because they often ARE secrets from environment variables, just surfaced through a tool and then persisted where they should not be.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T19:58:26.688491+00:00— report_created — created