Repository navigation
fix(plugins): prevent terminal controls in installation reports - #184454
Leon-SK668 wants to merge 1 commit into
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 changesSanitize file-derived identifiers and destinations in plugin and hook installation messages while preserving raw installation data. Example: Install a plugin whose manifest ID contains café, an ANSI color escape, and a newline before FORGED.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a concrete terminal-output defect with a small, focused patch; no actionable findings remain, and exact-head CI passes. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherPlugin and hook installers read package metadata, copy artifacts, and record installation state; their CLI messages now sanitize displayed fields without modifying operation inputs or results. flowchart LR
A[Package and hook metadata] --> B[Existing installation owners]
B --> C[Raw artifacts and installation state]
B --> D[Human message templates]
D --> E[Canonical terminal sanitizer]
E --> F[CLI output]
Technical reviewBest possible solution: Merge the focused display-boundary repair using the existing sanitizer and unchanged installation owners. Do we have a high-confidence way to reproduce the issue? Current source accepts embedded controls in IDs and interpolates them into installation reports; the contributor also supplies compiled-CLI RED/GREEN observations, which were inspected without rerunning target code. Is this the best way to solve the issue? This is the smallest complete repair for the stated messages: sanitize displayed substitutions in existing owners, preserving raw identities, trusted formatting, and lifecycle behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 79798ed63e1d. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests +100. Total +103 across 5 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel 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 Reviewed October 26, 2026, 5:46 AM ET / 09:46 UTC. |
…amilies (#186502) fix(cli): route remaining CLI reports through the terminal-text owner After #185927 added one owner for escaping untrusted values in CLI output, contributors kept opening one PR per command to escape the next report. This moves the remaining human-readable reports in the plugins, secrets, sessions, memory and memory-wiki, workboard, backup, pairing, oc-path, config and setup commands onto `terminalText` / `displayPath`, and extends the owner to neutralize bidirectional control characters. JSON output, persisted identities, raw exports and the CLI's own colors are unchanged, and the trusted styling of `renderTable` is untouched. This absorbs the per-site fixes from @Leon-SK668 (#184454, #184379, #185374, #186449, #184396, #184788, #184813, #184394), @huwei-xydt (#185895, #185719), @wangmiao0668000666 (#175600, #175181, #175179), @SunnyShu0925 (#184747), @KrasimirKralev (#184597) and @arpe1618 (#150599), whose original commits are kept. Families no PR touched (update, Doctor, install-trust producers and others) are listed under "Not fixed here". Evidence: 85 built-CLI invocations per ref with crafted control and bidi characters in the reported values, captured as raw stdout bytes. Main printed the raw sequences; this change printed them neutralized, with identical normal colors and unchanged JSON. Details: #186502 (comment). Co-authored-by: 胡伟0668000622 <[email protected]> Co-authored-by: Claude Code <[email protected]> Co-authored-by: Leon-SK668 <[email protected]> Co-authored-by: wangmiao0668000666 <[email protected]> Co-authored-by: SunnyShu <0668000539@local> Co-authored-by: Krasimir Kralev <[email protected]> Co-authored-by: arpe1618 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
|
Thanks @Leon-SK668. This is now fixed at the root in #186502 (3bcca4f), which routes the remaining CLI reports through the shared |
…amilies (openclaw#186502) fix(cli): route remaining CLI reports through the terminal-text owner After openclaw#185927 added one owner for escaping untrusted values in CLI output, contributors kept opening one PR per command to escape the next report. This moves the remaining human-readable reports in the plugins, secrets, sessions, memory and memory-wiki, workboard, backup, pairing, oc-path, config and setup commands onto `terminalText` / `displayPath`, and extends the owner to neutralize bidirectional control characters. JSON output, persisted identities, raw exports and the CLI's own colors are unchanged, and the trusted styling of `renderTable` is untouched. This absorbs the per-site fixes from @Leon-SK668 (openclaw#184454, openclaw#184379, openclaw#185374, openclaw#186449, openclaw#184396, openclaw#184788, openclaw#184813, openclaw#184394), @huwei-xydt (openclaw#185895, openclaw#185719), @wangmiao0668000666 (openclaw#175600, openclaw#175181, openclaw#175179), @SunnyShu0925 (openclaw#184747), @KrasimirKralev (openclaw#184597) and @arpe1618 (openclaw#150599), whose original commits are kept. Families no PR touched (update, Doctor, install-trust producers and others) are listed under "Not fixed here". Evidence: 85 built-CLI invocations per ref with crafted control and bidi characters in the reported values, captured as raw stdout bytes. Main printed the raw sequences; this change printed them neutralized, with identical normal colors and unchanged JSON. Details: openclaw#186502 (comment). Co-authored-by: 胡伟0668000622 <[email protected]> Co-authored-by: Claude Code <[email protected]> Co-authored-by: Leon-SK668 <[email protected]> Co-authored-by: wangmiao0668000666 <[email protected]> Co-authored-by: SunnyShu <0668000539@local> Co-authored-by: Krasimir Kralev <[email protected]> Co-authored-by: arpe1618 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: successful plugin and hook-pack installation reports print accepted file-derived IDs and destination names as terminal controls, allowing metadata to create a forged report line.
User Impact
Installation progress and completion remain readable single-line reports, preserving ordinary Unicode. The real plugin/hook IDs, copied files, configuration keys, SQLite install records, consent and activation behavior remain unchanged. There are no new settings, permissions, storage formats, protocol changes, migrations or required operator actions.
Why This Change Was Made
Use the existing
sanitizeTerminalTexthelper only when interpolating file-derived fields into human messages: the shared directory-install progress, native manifest/package-name notice, and CLI plugin/hook completion. Keeping this in the existing message producers also covers their shared callers without changing raw install results or typed Gateway activity events.Filtering the entire CLI logger would damage trusted multiline notices, policy boxes and terminal links, so those messages retain their current formatting. Linked source-path confirmations echo the operator's argument and are deliberately unchanged, following the boundary retained in #176007. Existing terminal-core functionality is sufficient; no new parser, helper, validation rule, dependency or output mode is needed.
This is separate from installed list/inspect (#172873), uninstall (#175600), registry search (#175181), hook toggles (#184303), and authoring validate/pack (#184379). Their changed-file lists and the relevant live diffs were checked; none repairs these installation message producers.
Evidence
Actual compiled-CLI RED:
18d2633de8abd677ae1852b48950701bce8ff302. Exact candidate GREEN:cc96e064cb0d26985878f7857cb66ce4264aa58e, based on main95dff1e02bc59bc86dd6e75ff93d7ab2714daac9. The three changed producers, hook admission, shared CLI logger and terminal sanitizer are identical between the executed RED baseline and parent. A fresh source check against mainc60dc99f3f966a844f999598aa41d04b4276e29aconfirms these owners and the publication/testing contracts remain unchanged; a native merge-tree check is clean. This is source-equivalence evidence, not a claim that the later main build was executed.Two frozen drivers use normal local installation through the actual built CLI, with independent configuration, HOME and state directories. Both source paths are ordinary ASCII. The controlled ID occurs only in real
HOOK.mdoropenclaw.plugin.json, never in argv. The hook fixture has its normal descriptor and empty handler; the native plugin has a real package, manifest and compiled JavaScript entry, no dependencies, explicit consent and--no-enable.Representative public commands:
The ordinary ID is
leon-café-🦀. The controlled ID is described with explicit code-point notation:leon-café<ESC>[31m<LF>FORGED<TAB>row<CR>🦀, where ESC/LF/TAB/CR mean U+001B/U+000A/U+0009/U+000D. All four CLI invocations on each build exit 0, signal null, with empty stderr.The unsafe-control count excludes the CLI's intended structural LF; the separate forged-line assertion checks the metadata's embedded LF. Captured GREEN excerpts below use visible
\n,\tand\rtext, with only the owned fixture path redacted:A separate reader opens the actual source and installed files again, rereads both real config files and SQLite databases for each driver, and compares the complete stored records. Hook config retains the exact raw enabled key and
config_machine_state[hooks.internal.installs]record. Native plugin state retains the exact rawplugins.installedIndex.index.installRecords[id], accepted-surface receipt and source/target; the plugin system remains disabled and the registration marker is absent. All source/installed bytes match. The reader makes zero OpenClaw CLI calls and performs no writes. No Gateway, hook handler, model, real channel or external service is invoked.Both source revisions are clean and match
dist/build-info.json.commit. Frozen hook driver SHA256:4591c4b109929afb637bca0ebf97e5ba7116096339e3d18cc5f3d16855134298; frozen native-plugin driver:9391ef25cd5d86bff7d1f9b506435aa03a4d56a1437bc356a396940c3e35691e. The same drivers run on both builds. Summed CLI time is 49.245 s for RED and 41.008 s for GREEN (not a product performance benchmark).e7e6767c528aef658084db0e7ef4eba9c63c887a1e56b83569f0955fb51537355ece306b6645f6fc0a69159a553deb7c5835703759e326adaef15a37e0ee6b6a7f2f5e9e6a885bae9a1deffb87e65b8469db835380c714334c0dd823626e0482f093be046e41d62cf497f689394a0feb2d9eb5f9b668203d3cfcd18821be1a5eSeparate existing-artifact reader SHA256:
33b139b8989e4da9422241320b5e705556b22a548c365bff20628a517a94b235; its resulte50bcff60260e2a897b8e38d48adc84b045b5361de993bdf2b9c4c3d494b2ab2passes all eight actual RED/GREEN cases. The hashes identify retained local records; the captured output, control observations and real-state readback above are the inline behavior evidence.Validation:
sourcePerformancebuild PASS, 289.07 s.Not tested: interactive terminal rendering, Windows/macOS, remote/ClawHub installation, linked paths, plugin activation, every failure/inspection/update diagnostic, packaged upgrades, broad suites or hosted PR CI. In particular, opaque error strings and external subprocess output are separate existing paths; this PR does not claim all installation diagnostics are sanitized. The bare-hook proof retains the existing compatibility scan-incomplete notice unchanged.
Agent Transcript
Implemented with Codex assistance. Actual task-scoped visible excerpt; unrelated turns, raw tool logs, credentials, private paths and reasoning omitted.
Authorized sanitized agent transcript
User: “多个子代理并行处理,提高效率。”
Assistant: “lint 拦下了一个真实问题:新增用例让安装测试文件超过 1000 行上限。子代理正在调整测试放置位置,保留原有覆盖和检查强度;生产修复仍维持原范围。”