Skip to content

fix: harden npm shell commands - #309

Open
damacus wants to merge 1 commit into
mainfrom
fix/harden-npm-shell-commands
Open

fix: harden npm shell commands#309
damacus wants to merge 1 commit into
mainfrom
fix/harden-npm-shell-commands

Conversation

@damacus

@damacus damacus commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Build npm install and uninstall commands with Shellwords
  • Escape npm list package arguments in helper checks
  • Update unit expectations for normalized command strings

Verification

  • cookstyle libraries/nodejs_helper.rb resources/npm_package.rb spec/unit/resources/npm_package_spec.rb
  • /opt/chef-workstation/embedded/bin/rspec spec/unit/resources/npm_package_spec.rb spec/unit/library/helper_spec.rb --format progress

@damacus
damacus requested a review from a team as a code owner June 8, 2026 14:56
Build npm commands with Shellwords and normalize command expectations.\n\nVerification:\n- cookstyle libraries/nodejs_helper.rb resources/npm_package.rb spec/unit/resources/npm_package_spec.rb\n- /opt/chef-workstation/embedded/bin/rspec spec/unit/resources/npm_package_spec.rb spec/unit/library/helper_spec.rb --format progress
@ramereth
ramereth force-pushed the fix/harden-npm-shell-commands branch from 8c12a64 to ab296d4 Compare August 16, 2026 04:40
@github-actions

Copy link
Copy Markdown

Slowest examples

Top 10 slowest examples (1.19 seconds, 33.29% of total time)
Example Description Time in seconds
spec/unit/resources/nodejs_repository_spec.rb:16 nodejs_repository on ubuntu is expected to create directory "/etc/apt/keyrings" 0.17373
spec/unit/library/helper_spec.rb:18 helper methods npm_dist should return a url based on the version 0.17219
spec/unit/resources/nodejs_install_spec.rb:16 nodejs_install package install on ubuntu is expected to install package "nodejs" 0.15
spec/unit/resources/nodejs_install_spec.rb:15 nodejs_install package install on ubuntu is expected to create nodejs_repository "nodesource" 0.13796
spec/unit/resources/nodejs_npm_packages_spec.rb:21 nodejs_npm_packages is expected to remove npm_package "nodejs_npm-left-pad-remove" 0.09428
spec/unit/resources/nodejs_install_spec.rb:88 nodejs_install source install is expected to install package "python3" 0.09416
spec/unit/resources/npm_package_spec.rb:25 npm_package install a versioned package is expected to run execute "install NPM package async" 0.09258
spec/unit/resources/nodejs_install_spec.rb:33 nodejs_install package install on rocky linux is expected to disable dnf_module "nodejs" 0.09184
spec/unit/resources/nodejs_install_spec.rb:113 nodejs_install source install on rocky linux is expected to run execute "install python3 build package" 0.09181
spec/unit/resources/nodejs_install_spec.rb:90 nodejs_install source install is expected to install_with_make ark "nodejs-source" 0.0918

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.

1 participant