Security: Replace exec() with execFile() in VS Code extension installer to prevent command injection
Description
The getAvailableClis() and getExtensionStatus() functions in source/vscode/extension-installer.ts use exec() with template string interpolation to run CLI commands:
// getAvailableClis (line ~78)
await exec(`${cli} --version`, { timeout: 2000, ... });
// getExtensionStatus (~line 108)
const {stdout} = await exec(`${cli} --list-extensions`, { timeout: 5000, ... });
exec() spawns a shell to interpret the command string. If the cli variable were to contain shell metacharacters (e.g. ; malicious-command), arbitrary commands could be executed. While cli currently comes from the hardcoded SUPPORTED_CLIS array, using shell-interpolated exec() is an unsafe pattern that is one refactor away from being exploitable.
Note: installToCli() already correctlyNote: installToCli() already correctlyNote: tNote:installToCli()already correctlyNote:installToCli()already correctlyNote: tNote: installToCl.g. via user config) withoutNote: installToCli()already correctlyNote:installToCli()already correctlyNote: tNote: installToCli() already correctlyNote: installToCli() already correctlyN)Note: install interpretation:
typescriptypescriptypescriptypescriptypesc })typescriptypescripcFiltypescriptypescriptypescriptypescriptypesc })```s n``\voke a shell, so arguments are passed directly to the OS — shell metacharacters cannot be injected.
File
source/vscode/extension-installer.ts (lines ~78 and ~108)
Severity
Security