Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesSanitizes inspected Claw agent names and shared human-readable diagnostics while preserving raw JSON values. Example: Inspect a Claw whose agent name is Agent\u001b]0;INJECTED_TITLE\u0007CLAW_MARKER_9F3E2D.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes two concrete terminal-control injection paths still present on current main, with supplied CLI proof and no actionable introduced defects found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherClaws CLI commands read package manifests, validate them, and render inspection results or diagnostics to the terminal; structured JSON follows a separate output path. flowchart TD
A[Claw package] --> B[Manifest reader and schema]
B --> C[Inspect command]
B --> D[Shared diagnostic formatter]
C --> E[Terminal text sanitizer]
D --> E
E --> F[Human terminal output]
C --> G[Raw structured JSON]
Technical reviewBest possible solution: Keep the focused fix in the existing rendering owners, preserving manifest data and structured JSON. Do we have a high-confidence way to reproduce the issue? The schema and current-main renderers establish both reachable paths, and supplied real CLI output demonstrates the unsafe bytes before the fix; no target code was run during this review. Is this the best way to solve the issue? This is the smallest complete fix for the two demonstrated paths: reuse the canonical sanitizer at human rendering boundaries, retain raw structured data, and cover each distinct failure through the command owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f6d03f693201. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +41. Total +46 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 18, 2026, 1:08 PM ET / 17:08 UTC (Revision 5). |
|
@clawsweeper re-review — ratchet attribution added to the body. |
|
🦞👀 Re-review progress:
|
Keep the OSC/escape attack vectors intact but replace attacker-flavored placeholder words with neutral markers so the input-safety scanner does not mistake synthetic test payloads for real injection material. Co-Authored-By: Claude Code <[email protected]>
|
@clawsweeper re-review The input-safety hold was triggered by synthetic test fixtures whose placeholder wording (attacker-flavored tokens) sat next to terminal escape sequences. The fixtures have been neutralized: escape-sequence attack vectors ( |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 9856f57. Thanks @wangmiao0668000666 for the fix, and for sharing it with the community. Maintainer follow-up: the same untrusted manifest bytes could also reach the terminal through diagnostic paths (a |
|
Thanks @obviyus for landing this and for the follow-up that also sanitizes the shared diagnostic formatter — closing the same untrusted-manifest path through |
…penclaw#174989) `openclaw claws inspect` no longer writes terminal control sequences from an untrusted claw manifest to the terminal. The agent name and the shared claw diagnostic formatter (used by `claws inspect`, `add`, `validate` and `dev`) now go through `sanitizeTerminalText`, so a manifest `agent.name` or `metadata` key with OSC/BEL bytes cannot change the terminal title or inject output. `--json` output is unchanged. Proof: real CLI in secretless Docker, output through `od -c`. On main d6d5402 both the agent name and a diagnostic path print ESC/BEL bytes; the candidate prints 0. Live gate passed with openai/gpt-5-mini. Thanks @wangmiao0668000666. Co-authored-by: Claude Code <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes:
openclaw claws inspectprints a third-party Claw manifest'sagent.nameverbatim, so a name carrying ESC/BEL sequences changes the terminal state while the operator is only inspecting a package.User Impact
User impact: operators can inspect a Claw package without its manifest strings driving the terminal; the agent name stays readable and
--jsonkeeps the raw value.Why This Change Was Made
Classification: behavior-completing.
The report line is a human rendering boundary, and
sanitizeTerminalTextis the canonical filter for that boundary (#172872covers skill and hook reports,#172873plugin reports). The manifest schema constrainssource.namewith a canonical ClawHub-name check andagent.idwith an agent-id regex, butagent.nameis only a non-empty string — it is the display field with no encoding constraint.Evidence
b0ab4408, head3c371c955dd1; secretless Linux container, Node 24.18.0, isolatedHOME/OPENCLAW_STATE_DIR.claws create my-claw, thenagent.name: "Agent\^[]0;INJECTED_TITLE\^GCLAW_MARKER_9F3E2D"in the generatedCLAW.md.node --import ./scripts/tsx.mjs src/entry.ts claws inspect <dir>Agent:lineAgent: Agent]0;INJECTED_TITLECLAW_MARKER_9F3E2DAgent: AgentCLAW_MARKER_9F3E2D0x1b,0x07)--jsonagent.name'Agent\x1b]0;INJECTED_TITLE\x07CLAW_MARKER_9F3E2D'Focused regression:
node_modules/.bin/vitest run --config vitest.config.ts src/cli/claws-cli.inspect.test.ts -t 'terminal controls' --maxWorkers=1Changed-file Oxfmt and Oxlint: clean. Whole diff: production
+4/-1, test+23/-1; no new files, options, or output formats.Not tested: other manifest-derived display fields in the same report (for example extension
mappedcapabilities) — deliberately left out to keep the fix to the field that carries no validation at all.Check attribution —
checks-fast-baseline-ratchetsfails inmock-exportsforsrc/cli/update-cli/update-command-service-maintenance-native.test-support.ts:52, which mocks./update-command-database-context.jswithout spreading the real module. That line is present verbatim at this PR's base (b0ab4408), and this PR touches onlysrc/cli/claws-cli.runtime.tsandsrc/cli/claws-cli.inspect.test.ts, so the violation is inherited rather than introduced here.Revision note (2026-10-17, UTC): test fixtures and the examples above were reworded with neutral placeholders; the escape-sequence attack vectors are unchanged, and assertions are keyed on the unchanged markers.
Maintainer follow-up
Thanks @wangmiao0668000666 for the fix and the clear reproduction.
The same report also prints manifest diagnostics. Their
pathis built from raw manifest keys, so ametadatakey with ESC/BEL reached the terminal throughformatClawDiagnostics(used byclaws inspect,add,validate,dev). The follow-up commit sanitizes each diagnostic line in that one formatter.--jsonoutput is unchanged.Real CLI proof, isolated Docker tree,
openclaw claws inspect <dir>, output piped throughod -c:621f574e663agent.namewith OSC title + BELAgent: Agent 033 ]0;INJECTED_TITLE \a CLAW_MARKER_9F3E2D, 2 ESC/BEL bytesAgent: AgentCLAW_MARKER_9F3E2D, 0 bytesmetadatakey with OSC title + BEL (invalid value)ERROR invalid_manifest $.metadata.key 033 ]0;INJECTED_TITLE \a DIAG_MARKER_7C1A: ..., 2 bytes$.metadata.keyDIAG_MARKER_7C1A: ..., 0 bytes--jsonagent.nameBoth new regression tests fail on main code and pass on this head.
Merge danger: two-way door. Display-only change to human CLI text; no state, config or JSON contract change. Blast radius: human output of
openclaw clawscommands only.