Skip to content

fix(core): accept Unicode dashes inside PowerShell string literals - #68738

Open
falai779 wants to merge 1 commit into
anomalyco:devfrom
falai779:fix/powershell-unicode-dashes
Open

falai779 wants to merge 1 commit into
anomalyco:devfrom
falai779:fix/powershell-unicode-dashes

Conversation

@falai779

@falai779 falai779 commented Dec 6, 2026

Copy link
Copy Markdown

Problem

scanPowerShell rejects any command containing U+2013..U+2015 before parsing, so a valid
command whose quoted argument contains an en dash fails with
Portable shell scanner cannot analyze command: invalid-structure. Reported in #61704.

Change

  • Dashes U+2013..U+2015 are no longer rejected globally. They are refused only where they can
    change what a command means: outside a recognized string literal, in unquoted command text,
    and in --% stop-parsing arguments.
  • Typographic quotes U+2018..U+201E stay rejected globally, because PowerShell may treat them as
    string delimiters, including inside an ASCII quoted string.
  • Oversized input now reports input-too-long instead of invalid-structure.

Safety

Inside a quoted literal the dash is data. Outside, the command is still refused, so no executable
text can hide behind a dash. Comments are scanned as comments, so dashes there are inert.

Tests

  • bun test packages/core/test/shell-scan/powershell-safety.test.ts: 242 pass, 0 fail.
  • tsc --noEmit --strict on scan.ts: clean.

The patch was rebased on the current dev branch (the pre-existing dash tests still pass).

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Dec 6, 2026
@github-actions

github-actions Bot commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 72 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

This branch has not been deployed

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

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant