INK-Q/agy-fast Windows unquoted command-chaining shell fallback vulnerability
Raw Developer Origin & Technical Request
GitHub Issue
Nov 24, 2026
### 现象
在 Windows 环境下,Antigravity 的系统提示告知模型当前 Shell 为 `pwsh`,因此模型调用 `run_checks`(或 `apply_edits` 的 `verify`)时经常写出 PowerShell 风格的分号串联命令,例如:
```powershell
agent-reach --version 2>&1; agent-reach --help 2>&1
```
实测该命令在 `run_checks` 中返回:
```text
## [PASS] cli-help (250ms)
$ agent-reach --version 2>&1; agent-reach --help 2>&1
Agent Reach v1.6.0
```
后半句 `agent-reach --help 2>&1` **实际根本没有执行**,且整条检查静默返回 `[PASS]`。
---
### 根因
在 `src/utils/exec-utils.ts`(截至 `v0.3.0` / `150d4b7`)中,`runShellCommandAsync()` 依赖 `needsPowerShellOnWindows(command)` 判断是否切到 `pwsh` / `powershell.exe`,否则走 `spawn(..., { shell: true })` 即 `cmd.exe`。
目前 `needsPowerShellOnWindows()` 仅匹配:
- `WINDOWS_PS_DOUBLE_QUOTABLE_VAR_RE`(`$env:*` / `$LASTEXITCODE` 等)
- `WINDOWS_PS_UNQUOTED_SYNTAX_RE`(`$HOME` / `$null` / `$(...)` / `@(...)` / `$x =` 等)
- `WINDOWS_PS_CMDLET_RE`(`Verb-Noun` cmdlet)
当串联命令中**不包含上述变量或 cmdlet、只包含未加引号的 `;` 分隔符**时,`needsPowerShellOnWindows()` 返回 `false`,命令被交给 `cmd.exe` 执行。
而在 `cmd.exe` 中 `;` 不是命令分隔符(`cmd.exe` 使用 `&` / `&&`),会被直接作为参数传递给前一个进程,复现如下:
```powershell
> cmd /c 'python -c "import sys; print(sys.argv)" --version 2>&1; echo SECOND 2>&1'
['-c', '--version', ';', 'echo', 'SECOND']
```
当第一个命令遇到 `--version` 直接打印版本号并退出 `0`(忽略多余参数)时,后续命令会被静默吞掉,且 `run_checks` 误报 `[PASS]`;其他命令则会把 `;` 及后续命令误判为非法参数而莫名报错。
(注:`unwrapTrivialWindowsPowerShellCommand()` 已通过 `WINDOWS_UNWRAP_FORBIDDEN_META_RE` 拦住了显式 `pwsh -c "a; b"` 中的 `;`,但直接传入的 `a; b` 仍会命中此问题。)
---
### 建议修复方向
在 `needsPowerShellOnWindows()`(已通过 `str...
Developer Debate & Comments
No active discussions extracted for this entry yet.
Adjacent Repository Pain Points
Other highly discussed features and pain points extracted from INK-Q/agy-fast.
Frequently Asked Questions
Market intelligence mapped to INK-Q/agy-fast Windows unquoted command-chaining shell fallback vulnerability.
How is INK-Q/agy-fast Windows unquoted command-chaining shell fallback vulnerability positioned in the market?
Are engineers actively discussing INK-Q/agy-fast Windows unquoted command-chaining shell fallback vulnerability?
What architecture is tied to INK-Q/agy-fast Windows unquoted command-chaining shell fallback vulnerability?
Engagement Signals
Cross-Market Term Frequency
Counts stored text matches for foundational terms like runShellCommandAsync and needsPowerShellOnWindows in analysed public discussions. These counts do not measure adoption.
Stored text matches, not adoption or market-share measurements.
- runShellCommandAsync: 1 records
- needsPowerShellOnWindows: 1 records
- cmd.exe fallback: 1 records
- command chaining: 1 records
SaaS Metrics