Repository navigation
fix(cli): sanitize untrusted pairing request fields before rendering - #175158
Closed
wangmiao0668000666 wants to merge 1 commit into
Closed
wangmiao0668000666 wants to merge 1 commit into
wangmiao0668000666 wants to merge 1 commit into
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes:
openclaw pairing listprints a pending request's sender id verbatim, so an id carrying terminal control sequences (ESC/BEL) changes the operator's terminal while inspecting untrusted senders — requests exist precisely because the sender is not trusted yet.User Impact
User impact: the pairing table renders every cell literally without control sequences, and
--jsonkeeps the raw values for scripts.Why This Change Was Made
Classification: behavior-completing.
This table is the untrusted-input case the terminal renderer already anticipates:
packages/terminal-core/src/table.tsshipsrenderTerminalSafeTable("Render untrusted single-line values without changing renderTable's trusted ANSI contract") next torenderTable, andpairing listwas the remaining caller feeding remote sender metadata into the trusted renderer. The swap is one call; no new helper, option, or output format.Precedent: #172872, #172873, #174989 (same shape at other human report boundaries).
Evidence
a45bf3ceb96, headf799dafc9bfe; secretless Linux container, Node 24.18.0, isolatedHOME/OPENCLAW_STATE_DIR.upsertChannelPairingRequest— one withmeta.senderId = "snd\u001b]0;pwned\u0007PAIR_MARKER", one plain.node --import ./scripts/tsx.mjs src/entry.ts pairing list --channel telegramtelegramUserIdcellsnd]0;pwnedPAIR_MARKERsndPAIR_MARKER0x1b,0x07)plain-senderplain-sender(unchanged)The
--jsonbranch returns{ channel, requests }before the table is built, so structured output is untouched by this diff.Focused regression:
node_modules/.bin/vitest run --config vitest.config.ts src/cli/pairing-cli.test.ts -t 'terminal controls' --maxWorkers=1Changed-file Oxfmt and Oxlint: clean. Whole diff: production
+5/-2, test+31; no new files, options, or output formats.Not tested: requests whose
codeorrequestedtimestamps are remote-controlled (both are generated locally by the pairing owner).