Closed as not planned
Closed as not planned
Description
Node.js Version
v24.2.0
NPM Version
11.4.2
Operating System
Windows 11
Subsystem
child_process
Description
After encountering this error;
(node:60880) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
The proposed quick fix of string concatenation of the command with its arguments will not work from this thread;
11.4.2
See how the following simple code sinippit returns zero for ssr's status and null for ssr2's status.
import {Buffer} from 'buffer';
import * as fs from 'fs';
import {spawnSync} from 'child_process';
let ssr = spawnSync('ls', ['-Al']);
console.log("ls -Al has a return / statusCode / status of " + ssr.status)
let ssr2 = spawnSync('ls -Al', []);
console.log("ls -Al has a return / statusCode / status of " + ssr2.status)
Minimal Reproduction
No response
Output
No response
Before You Submit
- I have looked for issues that already exist before submitting this
- My issue follows the guidelines in the README file, and follows the 'How to ask a good question' guide at https://stackoverflow.com/help/how-to-ask