-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Security: exec tool returns raw stdout/stderr to agent without secret redaction #71211
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.securitySecurity documentationSecurity documentation
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.securitySecurity documentationSecurity documentation
Type
Fields
Priority
None yet
Bug Report:
exectool returns raw stdout/stderr to agent without secret redactionSummary
Foreground
execresults in OpenClaw are assembled directly from aggregated command output and returned to the agent without an obvious secret-redaction pass. If a command prints secrets, those secrets can enter internal tool/agent context.Severity
High, internal secret exposure risk
Impact
execcommand that prints.envcontents, tokens, API keys, passwords, or other sensitive output can expose that data to the agent runtime.exectool path itself appears unsafe.Confirmed behavior
In the exec implementation, foreground output is returned via logic equivalent to:
And this is used directly after process completion:
This means
params.outcome.aggregatedis passed straight into the tool result text.Related files traced
dist/pi-tools-*.jsdist/bash-tools-*.jsdist/bash-tools.exec-runtime-*.jsWhat is not the issue
${SECRET}indirection in config is working as expected.EnvironmentFile=...rendering is not itself the leak.Evidence from code review
I found sanitization/redaction paths for:
I did not find a dedicated secret-redaction pass for generic
execstdout/stderr before tool result delivery.Reproduction idea
Run a command that prints a secret-bearing env file, for example:
cat /path/to/.envgrep TOKEN /path/to/.envObserved behavior:
exectool result returned to the agentExpected behavior:
Recommended fix
Best fix points:
buildExecForegroundResult(...)emitsparams.outcome.aggregatedoutcome.aggregatedSuggested protections
KEY=valueTOKEN,SECRET,PASSWORD,API_KEY,AUTH,PAT.envReal-world consequence seen
A diagnostic env-file read produced raw secret-bearing stdout into internal tool context during live troubleshooting. User-facing chat may have stayed clean, but the internal exposure path is confirmed and should be treated as a security bug.