Skip to content

Avoid Node.js DEP0190 warning by using string form for prepublish command - #1188

Merged
Raymond Zhao (rzhao271) merged 2 commits into
microsoft:mainfrom
tgrospic:avoid-node-spawn-warning
Aug 6, 2025
Merged

Raymond Zhao (rzhao271) merged 2 commits into
microsoft:mainfrom
tgrospic:avoid-node-spawn-warning

Conversation

@tgrospic

Copy link
Copy Markdown
Contributor

What this PR does

  • Fixes the Node.js DEP0190 deprecation warning:

    [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities...
    
  • Replaces the deprecated pattern:

    spawn(tool, ['run', 'vscode:prepublish'], { shell: true, ... });

    with the safe and supported string form:

    spawn(`${tool} run vscode:prepublish`, { shell: true, ... });

Why this matters

Why this is safe

  • The tool value is controlled (npm or yarn), no user input is involved.
  • The command is static and cannot be exploited.
  • This form fully avoids the DEP0190 warning in all supported Node.js versions.

Additional improvements

  • Extracts the command string into a prepublish variable for reuse in both logging and execution.
  • Improves readability without changing behavior.

@vs-code-engineering vs-code-engineering Bot added this to the August 2025 milestone Aug 4, 2025
auto-merge was automatically disabled August 5, 2025 08:48

Pull request was closed

@rzhao271
Raymond Zhao (rzhao271) merged commit 6b0b21d into microsoft:main Aug 6, 2025
adrianstephens pushed a commit to adrianstephens/vscode-vsce that referenced this pull request Jun 3, 2026
…mand (microsoft#1188)

* fix: avoid Node.js DEP0190 warning by using string command with shell: true

* refactor: extract prepublish command for clarity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants