Skip to content

Commit

Permalink
child_process: validate shell option in normalizeExecArgs()
Browse files Browse the repository at this point in the history
- narrow validation type to string (previously de facto not validated)
- ensure empty string is coerced to true
  • Loading branch information
Renegade334 committed Jan 2, 2025
1 parent 98d4ebc commit 68e4e69
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ function normalizeExecArgs(command, options, callback) {

// Make a shallow copy so we don't clobber the user's options object.
options = { __proto__: null, ...options };
options.shell = typeof options.shell === 'string' ? options.shell : true;

// Validate the shell, if present, and ensure a truthy value.
if (options.shell != null) {
validateString(options.shell, 'options.shell');
}
options.shell ||= true;

return {
file: command,
Expand Down

0 comments on commit 68e4e69

Please sign in to comment.