Repository navigation
fix(plugins): sanitize file-derived IDs in authoring reports - #184379
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 plugin IDs in successful validation and pack reports while preserving raw JSON and artifact metadata. Example: A plugin file declares the ID café<ESC>[31m<LF>forged<TAB>row<CR>🦀.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current CLI reporting defect with a minimal production change; no actionable introduced defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe plugin authoring CLI reads project metadata, validates or packs the project, and emits either structured JSON or human terminal reports. flowchart LR
A[Plugin project files] --> B[Authoring validation]
B --> C[Validation result or pack receipt]
C --> D[Raw JSON output]
C --> E[Terminal text sanitizer]
E --> F[Human success report]
B --> G[Unchanged plugin archive]
Technical reviewBest possible solution: Keep the existing reporting owners and sanitize only the displayed IDs, preserving exact metadata, JSON, archives, and receipts. Do we have a high-confidence way to reproduce the issue? Current-main source accepts the controlled ID and emits it directly at both report boundaries; supplied compiled-CLI before/after results demonstrate the failure, while this read-only review executed no target code. Is this the best way to solve the issue? This is the smallest complete repair for the stated successful-report defect: reuse the canonical sanitizer at both presentation boundaries without tightening plugin identity or changing serialization. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2499f2be3e88. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +2, Tests +90. Total +92 across 4 files. Added test files: 0. View PR surface stats
Review metrics
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 Reviewed October 26, 2026, 4:29 AM ET / 08:29 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
Successful
plugins validateandplugins packreports print the plugin ID read from the project's entry/manifest directly into human terminal output. A normally accepted ID containing control characters can therefore introduce terminal escapes or an extra apparent report line, even though the validation or archive creation succeeds.Why This Change Was Made
Reuse the existing terminal-text sanitizer at those two human ID interpolations. Both JSON branches return before display formatting, and the packer's raw receipt remains unchanged. The owner is the existing CLI reporting boundary in
src/cli/plugins-authoring-command.tsandsrc/cli/plugins-feature-artifact.ts, reached throughplugins-cli.ts.The current SDK
defineToolPlugin/definePluginEntryand normal manifest loader accept these string IDs; normal validation compares exact generated metadata. Tightening that input contract would be a different change. An existing sanitizer already handles the presentation operation, so no new helper, dependency, SDK export, parser, validation rule, or configuration is needed.This deliberately excludes init/build and explicit output-path confirmations, which echo the operator's arguments. It follows the file-derived-report boundary retained by the maintainer in #176007. Open #173178 fixes JSON5 manifest parsing in the adjacent authoring module and does not implement this output repair.
User Impact
Human validation and pack reports display the ID as readable terminal text, retaining ordinary Unicode while escaping CR/LF/TAB and removing terminal sequences. JSON plugin identity, exact project metadata, archive contents, digest, activation receipt, and output path remain unchanged. No plugin is installed or activated by this change; no permissions, defaults, protocol, storage, or migration behavior changes.
Evidence
Actual compiled-CLI RED:
18d2633de8abd677ae1852b48950701bce8ff302. Exact candidate GREEN:7e9b0c5af4e4e591877f8b43a9ea3ba1265321ad, based on mainf0d422a7cb485eb19ff9671aa3a588cb4cf3a46a. The authoring entry, metadata generator, validation, packer, SDK definition, loader, and package-entry admission owners are identical between the executed baseline and parent. A fresh check against mainf5eb9570aac03eccd09bf38d8a155d4039fc768ffinds those owners and the five publication contracts unchanged; native merge-tree verification is clean.The same frozen driver creates two isolated projects using normal built
plugins init, replaces each synthetic entry with an ordinary SDK-authored JavaScript plugin, and runs normalplugins build,validate,validate --json,pack, andpack --json. It supplies each project's own installed compiler from the checkout's existing dependency package, without downloading or changing the OpenClaw installation. Fixture paths are ordinary; the controlled ID exists only in the plugin file, never as a validate/pack argv value.Representative public commands:
The two project IDs are plain
café-🦀and a controlled string described here with explicit notation:café<ESC>[31m<LF>forged<TAB>row<CR>🦀, where the bracketed names mean code points U+001B, U+000A, U+0009 and U+000D. All 12 actual CLI invocations on each build exit 0 with empty stderr. On RED, validate/pack human output contains the control sequences and forged line; on GREEN it contains visible escape text on the original report line. Init/build output and the Unicode-only fixture remain unchanged.Captured GREEN human output, with only the fixture directory redacted;
\n,\t, and\rbelow are visible text:Captured GREEN validation JSON parses to
valid: true,errors: []and the original controlled ID. Independent readback compares that parsed ID with the source manifest's exact string, including all four control code points above. This paragraph uses explicit code-point notation because the GitHub body transport rewrites the ESC escape representation; the saved raw subprocess output and receipt hashes remain unchanged.The real controlled archive is 685 bytes with the digest above. Both human and JSON pack commands produce byte-identical archives; a separate reader extracts the actual
package/openclaw.plugin.jsonand compares it byte-for-byte with the source manifest. Its original controlled ID remains intact. The reader also checks actual package/entry files, archive digests, JSON activation path/digest, and all 24 saved process streams. It issues zero new OpenClaw CLI calls. These are real pack/readback operations, without installation, activation, Gateway, model, external API, or production state.RED takes 41.453 s and exact-head GREEN 37.520 s. The clean source revision and
dist/build-info.json.commitmatch on both runs. Frozen driver SHA256:4a245f808345d577a57aef54ccc0698073ddf8ae28b1673b21d3cd7ebba7965a; source/build-guard wrapper:ad01d6e60fb9dd52ec8b6bf07ed73f2fab91d7cdc25f8cbe8e521f9daf830192. RED receipt:6eb5333f81c3126b7a5bac28202234323b9a5b302a4fce73506f024baef762c6; GREEN receipt:623336bec0f13df85ea5ef2fab5f0c70792dc77c44645b7e45d234f27acb5b8d; independent GREEN readback:dfcccad79c9274e3b9b4010f0d3374725c66f454fa237c05d7eb4ae6992a84f4.Validation:
sourcePerformancebuild PASS, 303.09 s. Local verification time is not a product performance benchmark.Not tested: plugin installation/activation, every authoring error diagnostic, sanitization of argv/output paths, GUI terminal rendering, cross-OS, packaged upgrades, broad suites, or hosted PR CI. This is a bounded successful-report repair, without a claim that all plugin diagnostics or all terminals have been exercised.
Agent Transcript
Implemented with Codex assistance. Actual task-scoped visible excerpt; unrelated turns, raw tools, credentials, private paths, and reasoning omitted.
Authorized sanitized agent transcript
Assistant: “另一个终端输出候选已缩小范围,排除了仅回显用户输入、维护者曾不接受的改动。”