Skip to content

fix(plugins): sanitize registry package fields in the search report - #175160

Closed
wangmiao0668000666 wants to merge 1 commit into
openclaw:mainfrom
wangmiao0668000666:fix/plugins-search-report-controls
Closed

wangmiao0668000666 wants to merge 1 commit into
openclaw:mainfrom
wangmiao0668000666:fix/plugins-search-report-controls

Conversation

@wangmiao0668000666

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: openclaw plugins search <query> prints ClawHub registry package names and summaries verbatim, including the derived Install: hint, so a crafted registry entry can drive the operator's terminal from a read-only search.

User Impact

User impact: search results render their labels literally without control sequences; --json keeps the raw registry payload.

Why This Change Was Made

Classification: behavior-completing.

formatPackageSearchLine is the rendering boundary for registry-authored text: package.name and package.summary come from the ClawHub response, and name also feeds the install hint. sanitizeTerminalText is the canonical filter for that boundary (#172872, #172873, #174989). The fix wraps the displayed name, summary, and the install spec exactly where they are interpolated; the --json branch returns before this line and is untouched.

Evidence

  • Base a45bf3ceb96, head afe7583e983e; secretless Linux container, Node 24.18.0, isolated HOME/OPENCLAW_STATE_DIR.
  • Fixture: loopback registry stub (python http.server) serving /api/v1/packages/search with two results — one whose package.name/summary carry OSC sequences, one plain — selected through OPENCLAW_CLAWHUB_URL=http://127.0.0.1:8787, the client's documented override.
  • Real entry, identical command on both revisions: OPENCLAW_CLAWHUB_URL=http://127.0.0.1:8787 node --import ./scripts/tsx.mjs src/entry.ts plugins search evil
base this head
tainted result line evil]0;xSEARCH_NAME_MARKER code-plugin | official | v1.0.0 — desc]0;ySEARCH_SUMMARY_MARKER evilSEARCH_NAME_MARKER code-plugin | official | v1.0.0 — descSEARCH_SUMMARY_MARKER
Install: hint openclaw plugins install evil]0;xSEARCH_NAME_MARKER openclaw plugins install evilSEARCH_NAME_MARKER
unsafe control chars (C0 minus tab/LF/CR, DEL, C1) 6 0
plain result plain-plugin code-plugin | v2.0.0 — plain summary unchanged

Focused regression: node_modules/.bin/vitest run --config vitest.config.ts src/cli/plugins-search-command.test.ts -t 'terminal controls' --maxWorkers=1

base:  × strips terminal controls from registry package names and summaries
       AssertionError: expected 'ClawHub plugins (2)\nevil\u001b]0;x…' not to match /\p{Cc}/u
head:  ✓ strips terminal controls from registry package names and summaries

Changed-file Oxfmt and Oxlint: clean. Whole diff: production +3/-2, test +37; no new files, options, or output formats.

Not tested: registry-provided latestVersion/channel/family labels in the same line (family and channel are enum-constrained; the version label is rendered through formatVersionLabel).

@clawsweeper

clawsweeper Bot commented Oct 17, 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 cli CLI command changes size: XS r: too-many-prs Auto-close: author has more than twenty active PRs. labels Oct 17, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes r: too-many-prs Auto-close: author has more than twenty active PRs. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant