Skip to content

Feat (Approvals): Warn on Invisible or Bidirectional Characters in Commands - #923

Open
z3roX882706 wants to merge 1 commit into
YishenTu:mainfrom
z3roX882706:pr/bidi-command-warning
Open

Feat (Approvals): Warn on Invisible or Bidirectional Characters in Commands#923
z3roX882706 wants to merge 1 commit into
YishenTu:mainfrom
z3roX882706:pr/bidi-command-warning

Conversation

@z3roX882706

Copy link
Copy Markdown

Splitting the independently-useful piece out of #911 as suggested.

Command approval requests render the command string directly. That text can carry invisible controls or bidirectional overrides (Trojan Source style) so the visible rendering differs from what would actually run. This adds a provider-independent warning above the command when such characters are present, prompting the user to review the exact command before approving.

No shell parsing, no heuristic boundary, and no change to what executes: it only flags text whose appearance may not match its content.
Detector covers C0/C1 controls, DEL, zero-width, LRM/RLM/ALM, bidi embeddings/overrides/isolates, word joiner, and BOM.
Pure detector in its own module with focused unit tests.

…mands

Command approval requests render the command string directly. Text can
contain invisible controls or bidirectional overrides that make the
visible rendering differ from the bytes that would run (a Trojan Source
style spoof), so what the user sees is not necessarily what gets executed.

Add a provider-independent display safeguard: when the approval command
text contains invisible, control, or bidi-spoofing characters, show a
warning above it so the user reviews the exact command before approving.

- suspiciousCommandText.ts: pure detector (no shell parsing, no execution
  change) covering C0/C1 controls, DEL, zero-width, LRM/RLM/ALM, bidi
  embeddings/overrides/isolates, word joiner, and BOM.
- InputController: render the warning ahead of the command description.
- Focused unit tests for the detector.

This does not interpret shell syntax or alter what runs; it only flags
text whose appearance may not match its content.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant