Repository navigation
fix(oc-path): sanitize file-derived human inspection reports - #184394
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 leaf values and concrete paths in human-readable OC Path inspection reports. Example: Run path find on report.jsonc containing a café key and 中文🍵 value with U+009B, U+009D, and U+009C sequences.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current, source-verified rendering bug with a focused change and supplied CLI proof; no actionable defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe bundled OC Path plugin parses workspace files, resolves addresses, and renders CLI inspection results as human text or structured JSON. flowchart LR
A[Workspace file] --> B[Format parser]
B --> C[Path resolution and find]
C --> D[Human report sanitizer]
C --> E[Structured JSON output]
D --> F[Terminal stdout]
Technical reviewBest possible solution: Merge the focused display-boundary fix while preserving canonical addresses, structured output, and raw export bytes. Do we have a high-confidence way to reproduce the issue? Current-main rendering exposes the reported path: JSONC string values reach JSON.stringify and concrete paths reach stdout without C1 sanitization; supplied CLI evidence demonstrates the before/after result, but this read-only review ran no target code. Is this the best way to solve the issue? This is the smallest complete fix: reuse the canonical sanitizer in the existing human renderer, with no parser changes, competing owner, or new configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 977d7287c010. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +4, Tests +61. Total +65 across 2 files. Added test files: 1. 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 Reviewed October 26, 2026, 4:42 AM ET / 08:42 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
path resolve --humanandpath find --humancan copy C1 terminal-control characters from a JSONC key/value into an inspection summary. JSON quoting already escapes C0 characters, but it leaves C1 characters intact. A successful inspection should display readable text while preserving the underlying file and address identities.Why This Change Was Made
Reuse the existing public SDK
sanitizeTerminalTextat the shared human leaf formatter and at find's concrete-path display. Quote leaf values first to preserve the existing visible quoting. No new sanitizer, dependency, parser rule, configuration, or API is needed.registerPathCliowns these summaries; the existing find/resolve adapters and JSONC scanner supply the original data.The actual installed
jsonc-parserscanner accepts these C1 characters in ordinary JSON strings. Rejecting them or rewriting canonical paths would change the data contract. Explicitemit --human, dry-run source and diff output are byte-oriented artifacts, so their existing behavior is retained. This follows the accepted file-derived reporting boundary, rather than changing operator-argument echoes.All-state symptom, symbol and owner-path searches found no equivalent implementation. Open #172164 covers wildcard array tests and #180918 covers frontmatter comments; their overlap with the old test module does not implement this rendering fix. All original 70 tests remain unchanged.
User Impact
Human inspection keeps ordinary Unicode readable and strips control sequences from file-derived summaries. Structured JSON retains the exact original key/value/address. Explicit raw exports and source files retain their original bytes. There are no permission, configuration, default, storage, protocol, migration or dependency changes.
Evidence
Compiled-CLI RED: clean
18d2633de8abd677ae1852b48950701bce8ff302; GREEN: cleane230c34d3e215152d0d05ed418bcb6cf33ccd7ba, parent mainf0d422a7cb485eb19ff9671aa3a588cb4cf3a46a. The CLI/find/resolve/SDK sanitizer owners match between executed RED and parent. Fresh main95dff1e02bc59bc86dd6e75ff93d7ab2714daac9retains these owners and the publication contracts; native merge-tree verification is clean. Each run checksdist/build-info.json.commit == HEAD.The same frozen recorder uses ordinary synthetic JSONC files and the real built CLI/plugin registration in fresh isolated HOME/config/state. Its four actual commands are:
The controlled key is
caféfollowed by CSI/OSC/ST sequences (code points U+009B, U+009D and U+009C); the value starts中文🍵and contains the same kinds of controls. Both are accepted as normal file contents. All four commands exit 0 with empty stderr on both builds. RED human find contains six C1 characters; GREEN contains zero and produces this captured stdout:The Unicode-only positive remains identical. JSON parses to the original controlled path/value on both builds, and explicit
emit --humanremains byte-identical to the controlled input, including all six C1 characters. A separate reader reopens the actual two source files/config, checks their hashes, reparses JSON and all eight captured stdout/stderr streams, and checks exact human/raw output. It invokes zero new OpenClaw commands. There is no internal result injection, Gateway, model, external API or production state.RED takes 19.87 s; GREEN takes 20.12 s. Recorder SHA256
9083f2b67433dee304e7a3088dc40d36e1e6a919d0592d331639159d1baf4d8c; independent reader042849e3bda7a7802ff5da16a439fcb7e688a73f8a15f9a0f3ba7367b45023f0. RED receiptd2661f4f50144326bbdaa4763e3e570c62eb0b9152c6fc37005fd3874ba97eef; GREEN receiptca98087a4ca95f24b524df6c1a1e07676bf99f90b6f95c797d3366871e533d51. Raw JSON stdout hashes match across runs:d7e27e2816aa937bb3bbaa3daadb741d68681e1ea9edd956b868bc295a218e73.Validation:
tsconfig.extensions.json, full preparation and JSON diagnostics: zero diagnostics, two files, 293 rules, 87.05 s wall. Format/diff PASS. Exact-commit sourcePerformance build PASS, 298.58 s. These are local verification timings, not a runtime benchmark.Not tested: actual interactive TTY/screen/title effects, browser UI, cross-OS, packaged upgrades, every format, native
resolveas a separate subprocess, broad suites or hosted PR CI. Registered resolve tests exercise the shared formatter. Xterm.js and classic XTerm differ in UTF-8 C1 handling; this proves the actual stdout boundary and makes no universal terminal-execution claim.Agent Transcript
Implemented with Codex assistance. Actual task-scoped excerpt, with unrelated context, raw tools, credentials, private paths and reasoning omitted.
Authorized sanitized agent transcript
Assistant: “终端报告两条修复的构建已通过;
oc-path原生验证也通过,JSON 和原始导出字节保持不变,memory 的真实索引/搜索验证正在完成。”