Fix PowerShell parsing for standalone -- tokens - #335465
Fix PowerShell parsing for standalone -- tokens#335465Ingvar Stepanyan (RReverser) wants to merge 3 commits into
-- tokens#335465Conversation
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
There was a problem hiding this comment.
🔵 Needs a closer look
Terminal auto-approval parsing is security-sensitive and warrants final human review of PowerShell edge cases.
Pull request overview
Fixes PowerShell parsing of standalone -- tokens used by native CLI tools.
Changes:
- Masks standalone
--tokens before tree-sitter parsing while preserving offsets. - Adds regression coverage for Git pathspecs and
npm exec.
File summaries
| File | Description |
|---|---|
treeSitterCommandParser.ts |
Extends PowerShell native-argument masking. |
treeSitterCommandParser.test.ts |
Adds standalone -- parsing tests. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Hi Ingvar Stepanyan (@RReverser) I was also looking into the standalone
In my local testing, Tree-sitter parses the original Rather than masking every standalone |
Ugh it just keeps getting weirder. So tree sitter is fine with trailing But yeah, good catch if so, I'll update the PR. |
|
$val -- # OK
-- $val # OK
git diff -- # Error
git diff -- file.txt # Error |
|
Ugh that's trickier to distinguish. I guess an easy option might be to replace |
- Fixes microsoft#325635. - Fixes microsoft#324059. - Fixes microsoft#321748. Inspired by a similar fix in microsoft#310839.
d15b09a to
2e599be
Compare
Did this. I think it's conceptually more correct too - standalone |
This PR fixes an issue where VSCode would keep asking for approvals for any commands using
--for argument separation, even if such commands have already been included in theautoApprovepatterns.This is caused by treesitter being unable to parse this separator and VSCode forcing explicit approval for any unparsed commands.
chat.tools.terminal.autoApprovedoes not work fornpm exec -- ...commands #325635.Inspired by a similar fix in #310839.