Skip to content

Commit 1b8beb2

Browse files
committed
harden(cli): stop shipping a policy-bypass invocation inside the binary
`cbm update` printed the Windows update command with an execution-policy override baked in as a string literal. That put one of the most heavily weighted malicious-script patterns there is inside every Windows artifact we distribute — to save the user a single documented step. The command now prints without it. Functionality is unchanged: the user still gets a runnable command, and the failure it was pre-empting (PowerShell refusing a file that arrived from the internet) is answered by Unblock-File, which the message now names. The restricted-policy case is documented in the README's Windows install section, which is the right home for that incantation — a shipped binary is not. Scope note, so this is not oversold: the 2026-08-07 dry-run detections are NOT attributable to this string. It is `#ifdef _WIN32`, and every Windows artifact scanned clean; the three flagged artifacts were Linux and macOS. This is margin hygiene, not a fix for that regression — see the analysis in the PR. Verification limit worth stating: the built-artifact check for this string is vacuous on a non-Windows host, since the literal was Windows-only to begin with. What is verified here is the source (no occurrence outside a comment) plus lint and the cli suite; a real artifact check needs the Windows build leg in CI. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 74f540a commit 1b8beb2

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

‎src/cli/cli.c‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11498,18 +11498,29 @@ int cbm_cmd_update(int argc, char **argv) {
1149811498
}
1149911499
printf("codebase-memory-mcp update (current: %s)\n\n", CBM_VERSION);
1150011500
#ifdef _WIN32
11501+
/* The printed command deliberately carries NO execution-policy override.
11502+
* A policy-bypass invocation is one of the most heavily weighted
11503+
* malicious-script patterns there is, and emitting it as a literal put
11504+
* that signature inside every Windows artifact we distribute — to save
11505+
* the user one documented step. Pointing at Unblock-File reaches the
11506+
* same outcome and leaves the policy decision with them. README's
11507+
* Windows install section carries the override for the
11508+
* restricted-policy case: documentation is the right place to hand out
11509+
* that incantation, a shipped binary is not. */
1150111510
printf("The update runs from install.ps1, not from this process. Close any\n"
1150211511
"running sessions, then run\n\n");
1150311512
if (have_dir) {
11504-
printf(" powershell -ExecutionPolicy Bypass -File \"%s\\install.ps1\"\n\n", self_dir);
11513+
printf(" powershell -File \"%s\\install.ps1\"\n\n", self_dir);
1150511514
} else {
11506-
printf(" powershell -ExecutionPolicy Bypass -File install.ps1\n"
11515+
printf(" powershell -File install.ps1\n"
1150711516
" (ships in the release archive, and is placed beside the\n"
1150811517
" binary on install)\n\n");
1150911518
}
1151011519
printf("It downloads the latest release, verifies its checksum, and replaces\n"
11511-
"this binary in place. If PowerShell refuses to run the script because\n"
11512-
"it came from the internet, Unblock-File it first.\n");
11520+
"this binary in place. If PowerShell refuses to run the script, it is\n"
11521+
"usually because the file arrived from the internet: run\n"
11522+
"'Unblock-File install.ps1' first. If your execution policy still\n"
11523+
"blocks it, the README's Windows install section lists the options.\n");
1151311524
#else
1151411525
printf("The update runs from install.sh, not from this process. Run\n\n");
1151511526
if (have_dir) {

0 commit comments

Comments
 (0)