fix(cli): enforce permissions on shell commands the parser fails to scan - #12585
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The previously flagged WARNING (fail-closed fallback skipped when a command already parsed but an Files Reviewed (5 files)
Previous Review Summary (commit 342cba4)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 342cba4)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Otherwise the change is well-scoped: the Kilo-specific recovery logic lives entirely in Files Reviewed (5 files)
Reviewed by claude-sonnet-5 · Input: 26 · Output: 7.1K · Cached: 642.1K Review guidance: REVIEW.md from base branch |
…h execution test to kilo file
…can (Kilo-Org#12585) * fix(cli): enforce permissions on shell commands the parser fails to scan * fix(cli): fail closed on error chunks without command names, move pwsh execution test to kilo file
Fixes #12326.
On Windows, where pwsh/powershell is the default shell, bash permission rules were silently skipped for any command containing a bare
--argument, for examplegit checkout -- <file>. The tree-sitter-powershell grammar parses such commands into an ERROR node instead of a command node, so the permission scanner collected zero patterns and the shell tool executed the command without evaluating a single rule. This bypassed every bash rule, including"git *": "deny"and even a blanket"*": "deny", which is what the reporter hit when an agent reverted a file with git despite a configured deny rule. The same grammar path is inherited from upstream opencode's PowerShell support, so upstream is likely affected as well.The scanner now fails closed instead of skipping the check:
git checkout -- filematches"git *": "deny"again, including when it appears chained before a;separator.The recovery lives in a Kilo mirror module with a single marked hook in the shared shell scanner, keeping the upstream diff minimal. The interactive terminal shares this scanner and is covered by the same gate. Regression coverage runs on every CI OS since the scanner tests drive the PowerShell grammar without needing a pwsh binary, plus a Windows-runner-only test that executes the full shell tool through real PowerShell.