Skip to content

[build] Configure npm 11.x allowScripts for native module builds - #6038

Open
vrubezhny wants to merge 2 commits into
redhat-developer:mainfrom
vrubezhny:build/allow-install-scripts
Open

[build] Configure npm 11.x allowScripts for native module builds#6038
vrubezhny wants to merge 2 commits into
redhat-developer:mainfrom
vrubezhny:build/allow-install-scripts

Conversation

@vrubezhny

Copy link
Copy Markdown
Contributor

Summary

Replace --ignore-scripts with npm 11.x's allowScripts configuration for more secure and compatible native module handling.

  • Use explicit whitelist of packages allowed to run install scripts
  • Replace npm install with npm ci in build scripts (works better with allowScripts)
  • Use package name wildcards in allowScripts to handle transitive dependency version changes
  • Remove redundant .npmrc (npm 11.x prioritizes package.json allowScripts)

Why: npm 11.x enforces allow-scripts configuration. The blanket --ignore-scripts flag conflicts with this system. The new approach is more secure (explicit whitelist vs blanket ban) and compatible with Node 24.19's npm.

Fixes: vsce package command now works with Node 24.19 + npm 11.x

Configure allow-scripts in .npmrc to permit install scripts for packages
with native C/C++ bindings (cpu-features, ssh2, keytar, esbuild, etc.).
Required since upgrading to npm 11.x (bundled with Node 24.19+) which
enforces stricter allow-scripts configuration for vsce package operations.

Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Assisted-By: Claude Haiku 4.5 <noreply@anthropic.com>
…npm 11.x compatibility

Replace project-scoped npm install with npm ci in vscode:prepublish and
test:prepare scripts to work with npm 11.x's allow-scripts enforcement.
Use package name wildcards in allowScripts instead of specific versions
to handle transitive dependency version changes.

Remove --ignore-scripts flags from:
- package.json vscode:prepublish and test:prepare scripts
- .github/workflows/release.yml build dependencies
- .github/workflows/continuous-integration-workflow.yml test setup

npm 11.x enforces allow-scripts configuration, which is more secure than
--ignore-scripts (explicit whitelist vs blanket ban). The allowScripts field
in package.json now controls which packages can run install scripts.

Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Assisted-By: Claude Haiku 4.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.58%. Comparing base (da60441) to head (210f0ee).
⚠️ Report is 1954 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #6038       +/-   ##
===========================================
+ Coverage   32.37%   50.58%   +18.20%     
===========================================
  Files          85      114       +29     
  Lines        6505    10389     +3884     
  Branches     1349     2334      +985     
===========================================
+ Hits         2106     5255     +3149     
- Misses       4399     5131      +732     
- Partials        0        3        +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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