Skip to content

fix(cli): avoid encoded PowerShell commands - #11526

Merged
marius-kilocode merged 3 commits into
mainfrom
truth-athlete
Jun 23, 2026
Merged

fix(cli): avoid encoded PowerShell commands#11526
marius-kilocode merged 3 commits into
mainfrom
truth-athlete

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Windows endpoint security tools commonly treat powershell.exe -EncodedCommand <base64> as obfuscated command execution. Kilo started using that transport to avoid Windows PowerShell mojibake, but the command-line shape is indistinguishable from a common AV and EDR heuristic even when the decoded command is benign.

This keeps the Windows PowerShell UTF-8 setup from #11148 while making the executed command visible to PowerShell as plaintext via -Command. The wrapper still sets console input, console output, and `` to UTF-8 before running the approved command, so the Unicode behavior added for localized Windows output remains in place without the nested Base64 decode and ScriptBlock.Create path.

The result is a less suspicious process command line for Windows users and security tooling while preserving the intended PowerShell 5.1 and PowerShell 7 invocation shape.

Comment thread packages/opencode/src/kilocode/shell/shell.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/opencode/src/kilocode/shell/shell.ts
  • packages/opencode/test/kilocode/shell/shell.test.ts
Previous Review Summaries (2 snapshots, latest commit e95384d)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit e95384d)

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/shell/shell.ts 21 The new prologue parser still misses legal script prologues like [CmdletBinding()] and <# ... #> comments before param(...), so the UTF-8 setup can still invalidate advanced scripts.
Files Reviewed (2 files)
  • packages/opencode/src/kilocode/shell/shell.ts - 1 issue
  • packages/opencode/test/kilocode/shell/shell.test.ts - 0 issues

Fix these issues in Kilo Cloud

Previous review (commit 579a787)

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/shell/shell.ts 9 Appending the payload after the UTF-8 prelude breaks script-level PowerShell constructs like param, using, and #requires that must be the first statement.
Files Reviewed (5 files)
  • .changeset/calm-powershell-alerts.md - 0 issues
  • packages/opencode/src/kilocode/shell/shell.ts - 1 issue
  • packages/opencode/src/shell/shell.ts - 0 issues
  • packages/opencode/src/tool/shell.ts - 0 issues
  • packages/opencode/test/kilocode/shell/shell.test.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by gpt-5.4-20260305 · Input: 45.3K · Output: 5.5K · Cached: 78.3K

Review guidance: REVIEW.md from base branch main

Comment thread packages/opencode/src/kilocode/shell/shell.ts Outdated
@marius-kilocode
marius-kilocode merged commit e5a16d7 into main Jun 23, 2026
23 checks passed
@marius-kilocode
marius-kilocode deleted the truth-athlete branch June 23, 2026 08:32
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
fix(cli): avoid encoded PowerShell commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants