Skip to content

I don’t see an alternative: “DeprecationWarning: Passing args to a child process with shell option true …” #5063

Open
@rauschma

Description

@rauschma

Node.js Version

v24.0.1

NPM Version

11.3.0

Operating System

macOS Sequoia 15.3.2

Subsystem

child_process

Description

When using child_process.spawnSync() with an Array of arguments, I’m getting this warning:

DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.

I don’t see a simple way around that:

  • Command and arguments are passed to my function as an Array.
  • I can do my own concatenation but how is that any better than what Node.js is doing?
  • If I set shell:false then, e.g., I can’t invoke npx <some-package>.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions