fix: replace spawn shell option with explicit shell args to avoid Node.js DEP0190 warning#1234
Conversation
| ? ['/c', proxyContainerCommand] | ||
| : ['-c', proxyContainerCommand]; | ||
| // CLI tool intentionally executes user-provided proxy commands in container | ||
| // codeql-disable-next-line js/shell-command-injection-from-environment |
Check warning
Code scanning / CodeQL
Shell command built from environment values Medium
|
@afarber thanks for your contribution! |
a1ec67b to
8264897
Compare
8264897 to
fa8b5a7
Compare
| ); | ||
| const updateProcess = spawnFn(updateCommand, { stdio: 'pipe', shell: true }); | ||
| const isWindows = os.platform() === 'win32'; | ||
| const shell = isWindows ? 'cmd.exe' : 'bash'; |
There was a problem hiding this comment.
Is this better to use '/bin/sh' instead of 'bash' to avoid some conner case such as in Alpine it dose not have bash?
fix: replace spawn shell option with explicit shell args to avoid Node.js DEP0190 warning


TLDR
Replaces
spawn(command, { shell: true })andspawn(command, [], { shell: true })patterns with explicitspawn(shell, ['-c', command])to eliminate Node.js DEP0190 deprecation warning.Dive Deeper
Node.js 20+ introduced DEP0190 deprecation warning that triggers when passing an args array to
child_process.spawn()withshell: true. The warning exists because arguments are only space-concatenated, not properly escaped, which can lead to shell injection vulnerabilities.Before:
After:
This pattern was already used in shellExecutionService.ts for PTY spawning, so this PR applies the same approach consistently across all spawn calls.
Files changed:
Reviewer Test Plan
NODE_OPTIONS="--pending-deprecation --trace-warnings" npm run startTesting Matrix
Linked issues / bugs
Fixes #1115