Skip to content

fix(clawdock): keep credentials out of diagnostic output - #133547

Merged
steipete merged 1 commit into
mainfrom
steipete/wonderful-sinoussi-a758a7
Aug 30, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/wonderful-sinoussi-a758a7

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #133535

What Problem This Solves

Fixes an issue where operators running ClawDock token repair or config inspection would expose credential material in routine terminal output. clawdock-fix-token printed token prefixes, including a mismatched saved token, while clawdock-show-config printed openclaw.json verbatim despite advertising redacted values. The .env display also passed comments and multiline fragments through unchanged.

Why This Change Was Made

Keep the disclosure boundary at the helper that owns the diagnostics. Config inspection parses JSON5 and dotenv with dependencies already shipped in the OpenClaw Docker image, preserves structure/key names, and replaces every scalar value with a fixed redaction marker. Failed renderer output is withheld rather than printed partially or passed through raw.

Token repair checks both canonical config setters and the restart result without echoing their potentially sensitive output. The old readback comparison is removed: config get deliberately returns redacted secrets, and a second raw-config reader would duplicate include/environment-resolution policy owned by the config implementation. Failures now return nonzero instead of continuing to a misleading completion message.

User Impact

Routine ClawDock setup/repair/config output no longer reveals credential values or prefixes. The explicitly named clawdock-token command still prints the complete token on request. Docker port handling, Compose override ordering, and dashboard behavior are unchanged.

Config inspection requires Docker and the built OpenClaw image, but neither host-side Node/parsers nor a running gateway. Temporary renderer containers do not start dependencies. All values are hidden, including values under arbitrary plugin keys; comments are omitted. Ambiguous quote-leading dotenv values are conservatively withheld, with the limitation documented. Config and env file contents are not modified by inspection.

Evidence

  • Synthetic before/after Bash and Zsh probes reproduced credential disclosure in both automatic commands before the patch, suppressed it afterward, and confirmed exact full-token output remains available only through the explicit reveal command.
  • node scripts/run-vitest.mjs test/scripts/clawdock-helpers.test.ts: 34 passing tests, including short/long/shell-literal tokens, both setter failures, restart failure, nested JSON5 objects/arrays, multiline dotenv, parser/Docker failures, and explicit reveal. Existing Compose override and dashboard-port tests remain green.
  • node scripts/check-changed.mjs -- scripts/clawdock/clawdock-helpers.sh test/scripts/clawdock-helpers.test.ts docs/install/clawdock.md scripts/clawdock/README.md: passed.
  • bash -n scripts/clawdock/clawdock-helpers.sh, zsh -n scripts/clawdock/clawdock-helpers.sh, formatting, and git diff --check: passed.
  • Independent Codex prelanding autoreview on the unchanged frozen patch: scoped-clean at the configured P0 threshold, no findings.
  • Real Docker proof on blacksmith-testbox, lease tbx_01m1a78w22pebcs9k4dhswpjef, Testbox workflow: official OpenClaw 2026.7.1 image pinned to ghcr.io/openclaw/openclaw@sha256:2f5ce8848a1a69b3c460622e566cb9395da9fd18d7ef7b038cd8e2c4f195decf, Docker 28.0.4, Compose 2.38.2. Actual helper functions and installed CLI ran with synthetic temporary state, a nonroot gateway, networking disabled, no published ports, and only the proof-owned bind mount. Thirty assertions passed across the initial and focused runs: before/after disclosure, JSON5/dotenv rendering, exact explicit reveal, both persisted token fields, successful restart/health recovery, real write denial, real Compose parser failure, and missing-token handling. Fixture containers/networks/volumes/state were removed and the lease was independently verified completed.
  • Proof correction: an initial invalid-image interpolation fixture failed Compose config/run but did not fail exec/restart, so its expected-failure assertion was invalid. A focused rerun verified an actual Compose exec parser failure first and passed all six assertions. No product changes resulted. Restart failure after two successful writes is covered by the shell regression suite, not fault-injected in the real Docker run.

Production LOC: +45/-78 (net -33). Tests/test support: +291/-1 (net +290). Documentation: +8/-5. No new dependencies, config options, storage, or protocol changes.

The disclosure is present in stable v2026.7.1 source. No specific introducing commit or author is claimed. No operator state or real credentials were used in reproduction or regression tests.

Source identity: the final candidate is 42183e31ffee76b9e232793bdfd2e9c96a3259af, rebased once without changing any of the four reviewed files. Docker proof compared the original helper at 94259f243740d1d37530180e580210a907123661 (SHA-256 14ad11125fff8645ea438bb38c69588596d95935264ab37109ba1211e7ef8671) with the candidate helper (SHA-256 7d718c26fb04a32dbb66e431c67f28a63a4e0ce0bb7e04b6280e4b56280f44f3).

Final candidate verification repeated all 34 Bash/Zsh tests and the full changed-file gate (node scripts/check-changed.mjs --timed -- scripts/clawdock/clawdock-helpers.sh test/scripts/clawdock-helpers.test.ts docs/install/clawdock.md scripts/clawdock/README.md), all passing. The gate emitted a nonblocking temp-directory migration suggestion; the fixture already cleans up in finally.

Final CI: run 33335688305 completed successfully on 42183e31ffee76b9e232793bdfd2e9c96a3259af; the exact-head watcher exited 0 with GREEN. ClawSweeper reported no actionable findings. Its documented Docker-image prerequisite is accepted as part of the approved result; diagnostics intentionally withhold file contents if the image/parser is unavailable.

Keep routine repair and config inspection output free of credential values and prefixes while preserving explicit clawdock-token reveal. Use validated config setters and fail closed when diagnostic rendering fails. Fixes #133535.
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: M maintainer Maintainer-authored PR labels Aug 30, 2026
@steipete
steipete marked this pull request as ready for review August 30, 2026 21:10
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 5:19 PM ET / 21:19 UTC.

ClawSweeper review

What this changes

The PR redacts ClawDock configuration diagnostics and token-repair output, returning clear failures instead of printing credentials or backend diagnostics.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this maintainer-owned PR open for normal landing review: current main still exposes credentials, while the introduced patch removes those paths and has strong supplied real-Docker proof. The only remaining merge consideration is the documented fail-closed Docker-image prerequisite for configuration inspection.

Priority: P1
Reviewed head: 42183e31ffee76b9e232793bdfd2e9c96a3259af

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative credential-boundary repair with strong supplied real-Docker proof and one explicit compatibility tradeoff.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The changed production owner is the ClawDock helper; the supplied Testbox evidence exercises its real Docker and installed-CLI path with synthetic state and records after-fix redaction, successful persistence, and restart recovery. The linked workflow was unavailable to this reviewer because GitHub DNS failed, but that environment limitation does not negate the supplied evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The changed production owner is the ClawDock helper; the supplied Testbox evidence exercises its real Docker and installed-CLI path with synthetic state and records after-fix redaction, successful persistence, and restart recovery. The linked workflow was unavailable to this reviewer because GitHub DNS failed, but that environment limitation does not negate the supplied evidence.
Evidence reviewed 7 items Current main behavior: The fetched current-main helper still prints openclaw.json verbatim and forwards non-assignment .env content; its token repair also prints supplied and saved-token prefixes.
Introduced redaction boundary: The PR buffers renderer output, emits only parsed structure or redacted keys, and suppresses token setter and restart diagnostics before returning a clear failure.
Canonical configuration behavior: OpenClaw’s config CLI test establishes that sensitive configuration reads are redacted, supporting removal of the raw token readback comparison; both gateway token paths are registered secret surfaces.
Findings None None.
Security None None.

How this fits together

ClawDock is OpenClaw’s Docker setup helper. It reads host configuration and invokes the gateway CLI, then returns terminal diagnostics and repair status to the operator.

flowchart LR
  A[Operator command] --> B[ClawDock helper]
  B --> C[Host config files]
  B --> D[Docker gateway CLI]
  C --> E[Safe diagnostic renderer]
  D --> F[Token configuration]
  E --> G[Redacted terminal output]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Existing ClawDock users without Docker or the built image now receive a fail-closed diagnostic error rather than local configuration output; the PR documents this intentional security tradeoff.
  • Complete next step (P2) - No repair lane is needed because the patch has no concrete actionable defect; wait for ordinary exact-head CI and maintainer review.
Agent review details

Security

None.

PR surface

Tests +290, Docs +3, Other -33. Total +260 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 291 1 +290
Docs 2 8 5 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 1 45 78 -33
Total 4 344 84 +260

Review metrics

Metric Value Why it matters
Production versus test delta production −33, tests/test support +290, docs +3 net The credential-boundary repair removes more production shell code than it adds while adding focused regression coverage.
Diagnostic prerequisite 1 existing command now requires the Docker image clawdock-show-config intentionally fails closed when its image-backed parser is unavailable.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #133535
Summary: This PR is the explicit candidate fix for the open credential-disclosure report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept fail-closed diagnostics (recommended)
    Land the documented behavior that withholds configuration output when the Docker image or parser cannot be used.
  2. Pause for an offline renderer
    Defer the PR only if maintainers require a separately validated local renderer that preserves the same no-disclosure guarantee.

Technical review

Best possible solution:

Retain the helper-owned fail-closed renderer so routine diagnostics never disclose configuration values, while documenting Docker-image availability as its prerequisite.

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

Yes. Current main directly prints raw configuration and token prefixes, and the supplied real-Docker before/after run exercises the same helper boundary with synthetic credentials.

Is this the best way to solve the issue?

Yes. The patch fixes disclosure at the diagnostic helper that owns terminal output, reuses canonical config setters, and retains explicit token reveal only through the named command.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 343fe90926c0.

Labels

Label changes:

  • add P1: Routine operator diagnostics currently disclose credential material and this PR repairs that security-sensitive workflow.
  • add merge-risk: 🚨 compatibility: Configuration inspection now intentionally requires Docker and a built image instead of rendering directly from host files.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the ClawDock helper; the supplied Testbox evidence exercises its real Docker and installed-CLI path with synthetic state and records after-fix redaction, successful persistence, and restart recovery. The linked workflow was unavailable to this reviewer because GitHub DNS failed, but that environment limitation does not negate the supplied evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The changed production owner is the ClawDock helper; the supplied Testbox evidence exercises its real Docker and installed-CLI path with synthetic state and records after-fix redaction, successful persistence, and restart recovery. The linked workflow was unavailable to this reviewer because GitHub DNS failed, but that environment limitation does not negate the supplied evidence.

Label justifications:

  • P1: Routine operator diagnostics currently disclose credential material and this PR repairs that security-sensitive workflow.
  • merge-risk: 🚨 compatibility: Configuration inspection now intentionally requires Docker and a built image instead of rendering directly from host files.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The changed production owner is the ClawDock helper; the supplied Testbox evidence exercises its real Docker and installed-CLI path with synthetic state and records after-fix redaction, successful persistence, and restart recovery. The linked workflow was unavailable to this reviewer because GitHub DNS failed, but that environment limitation does not negate the supplied evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the ClawDock helper; the supplied Testbox evidence exercises its real Docker and installed-CLI path with synthetic state and records after-fix redaction, successful persistence, and restart recovery. The linked workflow was unavailable to this reviewer because GitHub DNS failed, but that environment limitation does not negate the supplied evidence.

Evidence

What I checked:

  • Current main behavior: The fetched current-main helper still prints openclaw.json verbatim and forwards non-assignment .env content; its token repair also prints supplied and saved-token prefixes. (scripts/clawdock/clawdock-helpers.sh:232, 343fe90926c0)
  • Introduced redaction boundary: The PR buffers renderer output, emits only parsed structure or redacted keys, and suppresses token setter and restart diagnostics before returning a clear failure. (scripts/clawdock/clawdock-helpers.sh:223, 42183e31ffee)
  • Canonical configuration behavior: OpenClaw’s config CLI test establishes that sensitive configuration reads are redacted, supporting removal of the raw token readback comparison; both gateway token paths are registered secret surfaces. (src/cli/config-cli.test.ts:1322, 42183e31ffee)
  • Regression coverage: The added tests cover Bash and Zsh token disclosure, setter and restart failures, JSON5 and dotenv redaction, renderer failures, and quote-leading malformed dotenv input. (test/scripts/clawdock-helpers.test.ts:142, 42183e31ffee)
  • Image dependency is present: Current main declares dotenv 17.4.2 and json5 2.2.3, and the Dockerfile installs production dependencies into the image used by the renderer. (package.json:2075, 343fe90926c0)
  • Real behavior proof: The reviewed PR body records an after-fix Testbox Docker run using the actual helper and installed CLI, with redacted synthetic state and observed recovery; the linked workflow could not be re-opened because GitHub DNS was unavailable in this review environment. (42183e31ffee)

Likely related people:

  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for 42183e31ffee76b9e232793bdfd2e9c96a3259af:

Exact-head CI run 33335688305 completed successfully. node scripts/watch-pr-ci.mjs 133547 42183e31ffee76b9e232793bdfd2e9c96a3259af exited 0 with GREEN. One pagination-snapshot retry resolved; no CI rerun or code changes were needed.

Final local commands passed:

node scripts/run-vitest.mjs test/scripts/clawdock-helpers.test.ts
node scripts/check-changed.mjs --timed -- scripts/clawdock/clawdock-helpers.sh test/scripts/clawdock-helpers.test.ts docs/install/clawdock.md scripts/clawdock/README.md
bash -n scripts/clawdock/clawdock-helpers.sh
zsh -n scripts/clawdock/clawdock-helpers.sh
git diff --check

All 34 Bash/Zsh tests passed. Independent Codex autoreview was scoped-clean at P0. Native review artifacts validated with READY FOR /prepare-pr, issueValidation.status=valid, and no findings. The single rebase preserved all four reviewed file hashes. Production LOC is −33 net.

Real Docker proof used blacksmith-testbox, lease tbx_01m1a78w22pebcs9k4dhswpjef, run 33334968996, and image ghcr.io/openclaw/openclaw@sha256:2f5ce8848a1a69b3c460622e566cb9395da9fd18d7ef7b038cd8e2c4f195decf (OpenClaw 2026.7.1). Thirty assertions passed across the initial and corrected focused scenarios: original disclosure reproduced; candidate redaction, both persisted token fields, successful restart/health recovery, denied writes, actual Compose failure, and exact explicit token reveal verified. Candidate helper SHA-256: 7d718c26fb04a32dbb66e431c67f28a63a4e0ce0bb7e04b6280e4b56280f44f3. Only synthetic temporary state was used; fixture containers/networks/volumes/state were removed and the lease was verified completed.

The initial image-interpolation fault was an invalid expectation for Compose exec; the focused rerun first established a real exec failure and then passed. Restart failure after successful writes is covered by shell regression tests, but was not injected in real Docker. The changed gate's temp-directory suggestion is warning-only; the fixture cleans up in finally.

ClawSweeper's completed review has no actionable findings or separate Rank-up moves list. Its Docker-image prerequisite tradeoff is accepted as part of the user-approved frozen result: withhold unsafe output when the image/parser is unavailable, with the requirement documented. Exact-head CI now satisfies its other next step. Matching live rulesets require the Actions-owned CI gate, with no enforced separate approval requirement. A queued review refresh does not supersede the fresh completed review of this unchanged head.

@steipete
steipete merged commit 00b64b8 into main Aug 30, 2026
219 checks passed
@steipete
steipete deleted the steipete/wonderful-sinoussi-a758a7 branch August 30, 2026 21:30
vincentkoc added a commit that referenced this pull request Aug 30, 2026
* origin/main: (55 commits)
  test: include v2026.8.1 release navigation (#133581)
  fix: stop cloud work before unrelated provider inspection finishes (#133476)
  fix(e2e): keep delete fixture target-compatible (#133526)
  fix(release): detect optional target E2E capability (#133525)
  fix(package): publish readable dist inventory (#133549)
  docs: add complete v2026.8.1 maintainer change index (#133585)
  fix(browser): preserve contextless worker and iframe sessions (#133571)
  fix(voice): discover configured provider candidates (#133507)
  refactor(ui): simplify chat rendering and lifecycle state (#133567)
  test: reduce maturity fixture cleanup time (#133566)
  improve: speed up legacy imports and transcript replacement (#133546)
  docs: add draft v2026.8.1 release notes (#133557)
  test: guard multi-project Vitest cache ownership (#133554)
  fix(memory): clarify default agent scope in command help (#133560)
  fix(clawdock): keep credentials out of diagnostic output (#133547)
  refactor(ui): avoid redundant presence work in avatar lists (#133548)
  fix(agents): recognize internal requester completion replies (#133543)
  fix: prevent duplicate queued user messages in chat clients (#133542)
  chore(ui): refresh control ui locales (#133544)
  fix(beam): restart delivery when the receiver changes (#133533)
  ...
vincentkoc added a commit to shojikumaru/openclaw that referenced this pull request Aug 30, 2026
…cked-delivery

* origin/main: (261 commits)
  fix(clawdock): keep credentials out of diagnostic output (openclaw#133547)
  refactor(ui): avoid redundant presence work in avatar lists (openclaw#133548)
  fix(agents): recognize internal requester completion replies (openclaw#133543)
  fix: prevent duplicate queued user messages in chat clients (openclaw#133542)
  chore(ui): refresh control ui locales (openclaw#133544)
  fix(beam): restart delivery when the receiver changes (openclaw#133533)
  fix(models): recover /models browse from a replaced prepared catalog (openclaw#133221)
  perf(terminal): reuse control scans and remove repeated sanitization work (openclaw#133527)
  perf(agents): prepare only consumed tool and skill diagnostics (openclaw#133512)
  fix(line): offer the card command only on LINE (openclaw#132895)
  fix: keep Android publication independent of core release (openclaw#133471)
  refactor(agents): simplify compaction accounting (openclaw#133521)
  refactor(plugins): simplify registration lifecycle policy (openclaw#133364)
  perf(plugins): avoid eager loader imports for active registry reads (openclaw#133518)
  refactor(ui): consolidate chat rendering ownership (openclaw#133508)
  test(auto-reply): prepare memory flush model capabilities (openclaw#133532)
  fix(ui): replace startup hourglasses with capacity-aware rings (openclaw#133470)
  fix(talk): preserve provider conversation order in browser transcripts (openclaw#133493)
  fix(ui): deduplicate participant and viewer avatars (openclaw#133519)
  feat(ui): add CRT terminal theme (openclaw#133495)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
…3547)

Keep routine repair and config inspection output free of credential values and prefixes while preserving explicit clawdock-token reveal. Use validated config setters and fail closed when diagnostic rendering fails. Fixes openclaw#133535.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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.

[Bug]: ClawDock repair and config diagnostics reveal credential values

1 participant