# @npmcli/promise-spawn@9.0.1 security report (npm)

- Verdict: **Needs review** (risk level: medium)
- Scanned: 2026-10-06T14:23:05.000Z
- Files reviewed: 2
- Findings: 2 medium, 1 low severity findings
- Report: https://security.togoder.click/npm/@npmcli/promise-spawn
- Source: Togoder Security (https://security.togoder.click), AI source-code review

## Summary

Togoder Security scanned the npm package @npmcli/promise-spawn@9.0.1 on Oct 6, 2026. An AI review of 2 source files produced 2 medium, 1 low severity findings. The overall verdict is medium: the findings flag risky but common patterns (dynamic code, unsafe defaults, broad file or network access) rather than confirmed malware.

## Findings

### [medium] Command execution with shell

Finding ID: `NPS-B9273B9BF1B0`

File: `lib/index.js:94`

The package spawns child processes and explicitly constructs shell commands via spawnWithShell, using /c or -c and manual argument escaping. While this is the package's stated purpose (a spawn wrapper like @npmcli/promise-spawn), it creates a command injection surface if callers pass untrusted input. The escaping logic is complex (especially Windows cmd escaping) and any bypass could lead to arbitrary command execution.

### [medium] OS command launching via 'open'

Finding ID: `NPS-4F1537846B35`

File: `lib/index.js:147`

The open() function launches platform-specific handlers (start, open, xdg-open, sensible-browser) with user-supplied arguments concatenated into a shell script string. If arguments are not fully sanitized, this can lead to command injection when opening files/URLs from untrusted sources.

### [low] Environment variable access

Finding ID: `NPS-73356323B53C`

File: `lib/index.js:97`

Reads process.env.ComSpec, process.env.PATH, process.env.PATHEXT, and process.env.BROWSER. This is used for platform detection and shell resolution, not credential harvesting, but it does access environment state that could be influenced by an attacker to alter which executable/shell is invoked (e.g., ComSpec/PATH hijacking).

## Files reviewed

- `lib/index.js` (medium): This is a legitimate spawn-wrapper utility (similar to @npmcli/promise-spawn) that intentionally builds and executes shell commands; the primary risks are command-injection surfaces inherent to shell spawning and argument escaping, not signs of deliberate malicious behavior.
- `lib/escape.js` (safe): No malicious patterns detected; the code is a standard implementation of command-line argument escaping for Windows cmd and POSIX sh.

AI analysis is guidance, not a guarantee. Methodology: https://security.togoder.click/methodology
