Togoder security

npm package security report

@npmcli/promise-spawn npm package: is it safe?

Risky patterns found that deserve a look.

Needs review Version 9.0.1 Files reviewed 2 Size 7.5 KB Scanned

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.

0
critical
0
high
2
medium
1
low

Findings 3

medium

Command execution with shell

NPS-B9273B9BF1B0

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.

lib/index.js:94
medium

OS command launching via 'open'

NPS-4F1537846B35

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.

lib/index.js:147
low

Environment variable access

NPS-73356323B53C

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).

lib/index.js:97

Files reviewed

FileVerdictWhat the reviewer saw
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.

Scanned versions of @npmcli/promise-spawn

VersionVerdictFilesScanned
9.0.1 Needs review 2 Oct 6, 2026

Frequently asked questions

Is @npmcli/promise-spawn safe to use?

No confirmed malware was found in @npmcli/promise-spawn@9.0.1, but the review flagged 2 medium, 1 low severity findings for risky patterns worth checking before you rely on it.

Does @npmcli/promise-spawn contain malware?

No malware was identified in @npmcli/promise-spawn@9.0.1 when Togoder Security scanned it on Oct 6, 2026. A new version can still introduce malicious code, so scan the exact versions in your lockfile.

How was @npmcli/promise-spawn checked?

Togoder Security downloaded the published npm package and had an AI model read its 2 source files, looking for install scripts, credential access, network exfiltration, obfuscation, backdoors and crypto-wallet theft. The results are cached by file hash and shown here.

How do I scan @npmcli/promise-spawn together with the rest of my dependencies?

Upload your lockfile at https://security.togoder.click/scan or call the API documented at https://security.togoder.click/api-docs. Files that have already been scanned, like the ones in @npmcli/promise-spawn@9.0.1, cost nothing.

Related security reports