Skip to content

fix: redact denied exec failure params - #85140

Merged
joshavant merged 3 commits into
mainfrom
fix/85049-redact-denied-exec-raw-params
May 22, 2026
Merged

joshavant merged 3 commits into
mainfrom
fix/85049-redact-denied-exec-raw-params

Conversation

@joshavant

Copy link
Copy Markdown
Collaborator

Summary

  • Problem: denied exec failures logged raw raw_params, which could include shell commands and inline credentials.
  • Solution: sanitize normalized exec failure params before formatting failure logs, omitting command text and env values while retaining safe metadata.
  • What changed: exec/bash failure logging now summarizes command/cmd, omits env values, handles JSON-string and malformed exec params, and adds escaped env-assignment redaction as defense in depth.
  • What did NOT change (scope boundary): non-exec tool failure parameter logging keeps its existing behavior.

Motivation

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Real behavior proof (required for external PRs)

  • Behavior addressed: denied exec tool failures still produce a useful failure log, but do not write raw command text or env values containing credentials.
  • Real environment tested: AWS Crabbox Linux direct provider, provider=aws, lease cbx_d7bedb291d7a, run run_46e34297e3b5.
  • Exact steps or command run after this patch: executed a denied gateway-host exec call with fake inline command credentials and fake env credentials, then inspected stderr, the OpenClaw file log, and tool result output.
  • Evidence after fix: AWS Crabbox output showed gatewayErrContainsOmittedCommand=true, gatewayErrContainsOmittedEnv=true, fileLogContainsOmittedCommand=true, fileLogContainsOmittedEnv=true, and all fake-token/export checks false.
  • Observed result after fix: denied exec logged raw_params={"command":{"omitted":true,...},"env":{"...":"[omitted exec env value]"},"timeout":5} with no fake token values and no export XAI_API_KEY text in combined proof output.
  • What was not tested: a full production channel conversation; the proof used the real OpenClaw exec tool path on AWS Crabbox with synthetic credentials.
  • Before evidence (optional but encouraged): AWS Crabbox run run_232c08c997df, lease cbx_1e896a6cf0f1, reproduced current-main leakage where denied exec raw_params contained the fake XAI and Brave token strings in stderr and file logs.

Root Cause (if applicable)

  • Root cause: src/agents/pi-tool-definition-adapter.ts formatted failed tool raw_params before applying any exec-specific command/env omission, so denied exec errors could serialize raw command input into stderr and file logs.
  • Missing detection / guardrail: logging tests covered general redaction but did not lock the denied exec failure-log path against raw command/env payloads.
  • Contributing context (if known): the generic redaction layer was best-effort pattern matching, but shell commands can contain credentials in arbitrary shapes.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/agents/pi-tool-definition-adapter.logging.test.ts, src/logging/redact.test.ts, plus AWS Crabbox repro proof.
  • Scenario the test should lock in: failed normalized exec/bash logs omit raw command/cmd and env values for object, JSON-string, and malformed params.
  • Why this is the smallest reliable guardrail: the adapter is the boundary that formats failed tool params for logs.
  • Existing test that already covers this (if any): none before this PR.
  • If no new test is added, why not: N/A.

User-visible / Behavior Changes

Failed exec logs no longer include raw command text or env values. They now include safe command metadata and env key names for correlation/debugging.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? Yes
  • New/changed network calls? No
  • Command/tool execution surface changed? Yes
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation: this reduces log exposure for command/tool execution failures by omitting command text and env values before log formatting. The tradeoff is less raw diagnostic detail for failed exec calls; retained metadata includes type, length, short hash, env keys, and non-sensitive fields such as timeout.

Repro + Verification

Environment

  • OS: Linux via AWS Crabbox
  • Runtime/container: Node 24 on direct AWS Crabbox checkout
  • Model/provider: N/A
  • Integration/channel (if any): exec tool path
  • Relevant config (redacted): host=gateway, security=allowlist, ask=off, empty safe bins

Steps

  1. Create an exec tool with gateway allowlist security and no safe bins.
  2. Execute a denied command containing fake inline credentials plus fake env credentials.
  3. Inspect stderr, file logs, and tool result output for omitted command/env markers and absence of fake secrets.

Expected

Denied exec failure is visible, but raw command text and env values are absent from logs.

Actual

AWS Crabbox proof passed with omitted command/env markers present and fake-token/export checks false.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: focused Vitest logging/redaction tests; maintainer autoreview; AWS Crabbox denied exec fix proof.
  • Edge cases checked: object params, JSON-string params, malformed command/env values, bash alias normalized to exec, and cmd payload alias.
  • What you did not verify: full production chat/channel flow.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: operators lose raw command text in denied exec failure logs.
    • Mitigation: logs retain safe metadata (type, chars, short sha256), env key names, and non-sensitive fields so repeated failures remain correlatable without exposing secrets.

@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label May 22, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
The PR sanitizes exec/bash failure-log params by omitting raw command/cmd text and env values, adds escaped env-assignment redaction coverage, regression tests, and a changelog entry.

Reproducibility: yes. Source inspection shows current main can throw an exec allowlist miss and then log serialized raw_params, and the PR body includes before-run Crabbox evidence for the same leakage path.

PR rating
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Summary: Focused security patch with strong source fit, targeted regression coverage, and detailed real-environment before/after proof.

What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Sufficient (live_output): The PR body includes before/after AWS Crabbox live-output details showing fake credentials leaked on current main and were absent from stderr, file logs, and tool output after the patch.

Risk before merge

  • Merging intentionally removes raw command text and env values from denied exec failure logs, so maintainers should accept the reduced diagnostic detail in exchange for avoiding credential exposure.
  • The linked issue is security-sensitive and the PR has the protected maintainer label, so the remaining decision is human review rather than an automation cleanup target.

Maintainer options:

  1. Decide the mitigation before merge
    Land the targeted adapter-level sanitizer after maintainer/security acceptance of the logging tradeoff and use the linked issue as the canonical closure target once merged or shipped.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge
No repair lane is needed because there is no discrete contributor-facing defect; the protected PR needs maintainer/security review of the logging tradeoff.

Security
Cleared: The diff reduces denied-exec secret exposure before log formatting and does not add dependency, permission, network, or code-execution surface.

Review details

Best possible solution:

Land the targeted adapter-level sanitizer after maintainer/security acceptance of the logging tradeoff and use the linked issue as the canonical closure target once merged or shipped.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection shows current main can throw an exec allowlist miss and then log serialized raw_params, and the PR body includes before-run Crabbox evidence for the same leakage path.

Is this the best way to solve the issue?

Yes, pending maintainer acceptance of the diagnostic tradeoff. Sanitizing at the adapter failure-log boundary is narrow, covers normalized exec/bash aliases and malformed params, and leaves non-exec failure logging unchanged.

Label justifications:

  • P1: The PR addresses credential exposure in denied exec failure logs, a security-sensitive workflow affecting real operators.
  • rating: 🦞 diamond lobster: Current PR rating is 🦞 diamond lobster because proof is 🦞 diamond lobster, patch quality is 🦞 diamond lobster, and Focused security patch with strong source fit, targeted regression coverage, and detailed real-environment before/after proof.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes before/after AWS Crabbox live-output details showing fake credentials leaked on current main and were absent from stderr, file logs, and tool output after the patch.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes before/after AWS Crabbox live-output details showing fake credentials leaked on current main and were absent from stderr, file logs, and tool output after the patch.

What I checked:

  • Current main logs raw failed tool params: Current main formats failed tool params through describeToolFailureInputs and logs raw_params/effective_params on ordinary tool failures before the PR's exec-specific sanitizer exists. (src/agents/pi-tool-definition-adapter.ts:281, 4faeb378ee49)
  • Current main exec denial throws through that failure path: Gateway allowlist misses throw exec denied: allowlist miss, matching the linked issue and PR reproduction path for failed exec logging. (src/agents/bash-tools.exec-host-gateway.ts:737, 4faeb378ee49)
  • Bash aliases normalize to exec: The current tool policy normalizes bash to exec, so the PR's normalized-tool-name approach covers the bash alias rather than adding a separate policy path. (src/agents/tool-policy-shared.ts:13, 4faeb378ee49)
  • PR diff targets the implicated boundary: The PR diff adds sanitizeExecFailureParamsForLog, passes toolName into describeToolFailureInputs, and sanitizes both raw and effective exec params before log formatting. (src/agents/pi-tool-definition-adapter.ts:116, 81c6f2e52465)
  • PR adds focused regression coverage: The PR diff adds tests for object params, JSON-string params, malformed command/env values, and bash/cmd alias behavior, plus a redaction test for JSON-escaped env assignments. (src/agents/pi-tool-definition-adapter.logging.test.ts:110, 81c6f2e52465)
  • Real behavior proof from PR body: The PR body reports before/after AWS Crabbox runs: current main leaked fake XAI/Brave token strings in stderr and file logs, while the patched run showed omitted command/env markers and false checks for all fake-token/export strings. (81c6f2e52465)

Likely related people:

  • steipete: Git history ties the current raw failed-tool-parameter logging path, the gateway allowlist-miss denial path, and the default redaction layer to Peter Steinberger's commits; this is the clearest current-main routing signal from local history. (role: feature-history owner and recent area contributor; confidence: high; commits: 192484ed0ae9, fec48a5006ea, 8be168b1807b; files: src/agents/pi-tool-definition-adapter.ts, src/agents/bash-tools.exec-host-gateway.ts, src/logging/redact.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 4faeb378ee49.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Cosmic Signal Puff

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: guards the happy path.
Image traits: location artifact grotto; accessory rollback rope; palette coral, mint, and warm cream; mood calm; pose leaning over a miniature review desk; shell woven fiber shell; lighting clean product lighting; background smooth stones and checkmarks.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Cosmic Signal Puff in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@joshavant
joshavant merged commit 221f534 into main May 22, 2026
99 checks passed
@joshavant
joshavant deleted the fix/85049-redact-denied-exec-raw-params branch May 22, 2026 01:10
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix exec failure log redaction

* docs: add exec redaction changelog

* test: satisfy redaction lint
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
* fix exec failure log redaction

* docs: add exec redaction changelog

* test: satisfy redaction lint
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* fix exec failure log redaction

* docs: add exec redaction changelog

* test: satisfy redaction lint
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* fix exec failure log redaction

* docs: add exec redaction changelog

* test: satisfy redaction lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exec-denied raw_params logged verbatim in gateway.err.log can capture cleartext env-var credentials

1 participant