Repository navigation
Description
ps::might_invoke_git's call-target branch matches any quote character after & or ., so a call operator or dot-source of a constant path is treated as possibly-git and refused by the fail-closed sink.
Repro
Via the PowerShell tool, against guardrails 0.19.0:
& "C:\tools\publish.ps1"
BLOCKED: this PowerShell 'git' command cannot be parsed with confidence — blocked (fail-closed).
The command has no git token and a constant path. Both quote styles and the dot-source form (. "…", . '…') over-block. The identical string on the Bash tool is allowed, isolating it to the PowerShell classifier.
Because ps::might_invoke_git is shared, block-no-verify false-blocks the same command too — one command, two blocks.
Mechanism
lib/powershell/ps-command.sh, the call-target branch of ps::might_invoke_git: the character class includes both quote characters, so any quoted target matches without inspecting its content. The literal-git probe immediately above already catches a quoted git command word quote-intact, so the quote branch is redundant for the case it was meant to cover — while causing this false positive.
Why it is safe to narrow
Per PowerShell about_Quoting_Rules, a $-free double-quoted string and any single-quoted string are compile-time constants. Such a target is statically decidable as non-git. Only an interpolating double-quoted target (& "$tool") is computed.
The fail-open guard rail: the fix must distinguish interpolated from literal. A blanket removal of the quote class would fail OPEN on & "$tool" commit.
Secondary defects in the same file
- The block message names backtick /
--%/ subexpression / script-block / here-string regardless of which of the four sink triggers actually fired, so "rewrite without the unparsable construct" is unactionable when the trigger was a launcher or a computed call target. - Unlike the sibling too-long and alias-cap fail-closed messages, this one omits the kill-switch line.
- Telemetry collapses all four sink triggers into one
powershell-unparsableform token, hiding which one over-blocks. - The git lane and the python-write lane answer the same "is this call target computed?" question with different regexes; only the python one is precise.
Direction
Fail-closed over-block, not a security hole.
Reported from a plugin-quality:audit run on a consuming project; reproduced against HEAD.
Activity