fix(gateway): preserve UTF-16 plugin approval fields#101580
Merged
Merged
Conversation
…TF-16 safe Node.js String.prototype.slice cuts at UTF-16 code unit boundaries, which can split surrogate pairs (emoji, CJK supplementary characters) into lone surrogates that render as U+FFFD in approval UI payloads. Use truncateUtf16Safe for both title and description fields in createPluginApprovalsAttachment so approval requests never deliver broken characters to the gateway approval UI. Fixes #???
Contributor
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(gateway): preserve UTF-16 plugin approval fields This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Contributor
Author
|
Land-ready at exact reviewed head
No docs or changelog change is required for this internal approval-payload boundary correction. |
Contributor
Author
|
Merged via squash.
|
This was referenced Jul 7, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 8, 2026
* fix(gateway): keep plugin approval title and description truncation UTF-16 safe Node.js String.prototype.slice cuts at UTF-16 code unit boundaries, which can split surrogate pairs (emoji, CJK supplementary characters) into lone surrogates that render as U+FFFD in approval UI payloads. Use truncateUtf16Safe for both title and description fields in createPluginApprovalsAttachment so approval requests never deliver broken characters to the gateway approval UI. Fixes #??? * test(gateway): exercise UTF-16 approval payloads --------- Co-authored-by: wm0018 <[email protected]>
giodl73-repo
pushed a commit
to giodl73-repo/openclaw
that referenced
this pull request
Jul 8, 2026
* fix(gateway): keep plugin approval title and description truncation UTF-16 safe Node.js String.prototype.slice cuts at UTF-16 code unit boundaries, which can split surrogate pairs (emoji, CJK supplementary characters) into lone surrogates that render as U+FFFD in approval UI payloads. Use truncateUtf16Safe for both title and description fields in createPluginApprovalsAttachment so approval requests never deliver broken characters to the gateway approval UI. Fixes #??? * test(gateway): exercise UTF-16 approval payloads --------- Co-authored-by: wm0018 <[email protected]>
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
Plugin approval titles and descriptions were capped with raw UTF-16 slicing. An emoji or other supplementary character crossing the 80/256-code-unit boundaries produced a lone surrogate in the gateway approval payload.
This clean current-main replacement supersedes #101478, whose branch accumulated repeated fixup commits, 301 unrelated changed files, and merge conflicts.
Why This Change Was Made
The gateway node-invoke policy owner now uses the canonical normalization-core UTF-16 helper at the existing caps. The regression drives a real dangerous plugin policy through pending approval creation and inspects the stored request fields.
The original implementation commit and @wm0018 authorship are preserved.
User Impact
Plugin approval prompts remain valid when capped text contains emoji or supplementary CJK characters. Approval routing, timeouts, and length limits are unchanged.
Evidence
node scripts/crabbox-wrapper.mjs run -- corepack pnpm test src/gateway/node-invoke-plugin-policy.test.ts— 28 tests passed across four gateway projects on Blacksmith Testboxtbx_01kwy3bk8pkgs7d418tezxk73a(run).oxfmt --checkon both touched files — passed.git diff --check— passed.