Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): strip .cmd/.bat shims in the runner allowlist too
Adam Eivy3b39b4209867
diff --git a/server/cos-runner/allowedCommands.js b/server/cos-runner/allowedCommands.jsindex 3b4061b0b7..22a3117ac3 100644--- a/server/cos-runner/allowedCommands.js+++ b/server/cos-runner/allowedCommands.js@@ -32,9 +32,10 @@ export function isAllowedCommand(command) {// Extract base command name from full path (e.g., /usr/bin/claude -> claude)// Uses path.basename for correct handling on both Unix and Windowslet baseName = basename(command);- // Normalize for Windows: strip trailing .exe (case-insensitive)- if (baseName.toLowerCase().endsWith('.exe')) {- baseName = baseName.slice(0, -4);- }+ // Normalize for Windows: strip a trailing shim extension (.exe / .cmd / .bat,+ // case-insensitive) so an npm/bun global-bin shim path (e.g. opencode.cmd,+ // claude.cmd) matches its bare allowlist entry — mirrors the basename ++ // extension normalization the OpenCode arg builders use (isOpencodeCommand).+ baseName = baseName.replace(/\.(exe|cmd|bat)$/i, '');return ALLOWED_COMMANDS.has(baseName);}diff --git a/server/cos-runner/allowedCommands.test.js b/server/cos-runner/allowedCommands.test.jsindex 7b3f110936..698904d0bd 100644--- a/server/cos-runner/allowedCommands.test.js+++ b/server/cos-runner/allowedCommands.test.js@@ -25,6 +25,17 @@ describe('isAllowedCommand', () => {expect(isAllowedCommand('opencode')).toBe(true);expect(isAllowedCommand('/opt/homebrew/bin/opencode')).toBe(true);});++ it('allows Windows npm/bun shim extensions (.cmd / .bat) for allowed commands', () => {+ // Bare + forward-slash forms parse the same on POSIX and Windows. (A full+ // backslash path like C:\\...\\opencode.cmd only splits via path.basename on+ // a Windows host — the existing claude.exe case documents that limitation.)+ expect(isAllowedCommand('opencode.cmd')).toBe(true);+ expect(isAllowedCommand('claude.bat')).toBe(true);+ expect(isAllowedCommand('/c/npm/opencode.cmd')).toBe(true);+ // still rejects a non-allowlisted command regardless of shim extension+ expect(isAllowedCommand('rm.cmd')).toBe(false);+ });});describe('Windows .exe stripping', () => {