#8073: fix(plugins): add --ignore-scripts to npm install
stale
Cluster:
Plugin Management Enhancements
## Summary
Adds `--ignore-scripts` flag to npm install during plugin installation to prevent supply chain attacks via malicious lifecycle scripts.
## The Problem
During plugin installation, `npm install` is called to install plugin dependencies. Without the `--ignore-scripts` flag, npm will execute lifecycle scripts (preinstall, postinstall, etc.) from the installed packages. This allows malicious packages to execute arbitrary code on the user's system.
## Changes
- `src/plugins/install.ts`: Added `--ignore-scripts` flag to the npm install command
- `src/plugins/install.ignore-scripts.test.ts`: New test that verifies the flag is present
## Test Plan
- [x] `pnpm build && pnpm check && pnpm test` passes
- [x] New test `describe('VULN-210: plugin install must use --ignore-scripts')` validates the fix
- [x] Test captures npm install commands and verifies `--ignore-scripts` is included
## Related
- [CWE-506: Embedded Malicious Code](https://cwe.mitre.org/data/definitions/506.html)
- [CWE-494: Download of Code Without Integrity Check](https://cwe.mitre.org/data/definitions/494.html)
- Internal audit ref: VULN-210
---
*Built with [bitsec-ai](https://github.com/bitsec-ai). AI-assisted: Yes. Testing: fully tested (test written before fix). Code reviewed and understood.*
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR hardens plugin dependency installation by adding `--ignore-scripts` to the `npm install` invocation in `src/plugins/install.ts`, preventing lifecycle scripts from running when installing untrusted plugin dependencies. It also introduces a Vitest regression test (`src/plugins/install.ignore-scripts.test.ts`) that mocks `runCommandWithTimeout`, installs a minimal plugin from a temp directory, and asserts the captured `npm install` command includes `--ignore-scripts`.
Overall direction looks correct and aligns with the plugin install flow: `installPluginFromDir` delegates to `installPluginFromPackageDir`, which runs `npm install` in the plugin’s target directory only when `package.json` has dependencies.
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with low risk; the core change is small and well-scoped.
- Adding `--ignore-scripts` to the npm invocation is a straightforward hardening change. The new test covers presence of the flag, though it could be made more robust by also validating the options passed to `runCommandWithTimeout` and disambiguating which `npm install` call is being asserted.
- src/plugins/install.ignore-scripts.test.ts
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#11432: fix(security): add --ignore-scripts to npm install in hook and plug...
by coygeek · 2026-02-07
86.8%
#8075: fix(skills): add --ignore-scripts to all package managers
by yubrew · 2026-02-03
85.5%
#14112: test(security): harden plugin install against script execution
by davidahmann · 2026-02-11
85.2%
#13169: security: add --ignore-scripts to npm install during plugin/hook in...
by RamiNoodle733 · 2026-02-10
84.7%
#8600: fix(update): add --ignore-scripts to prevent supply chain attacks
by yubrew · 2026-02-04
82.5%
#11032: fix(security): block plugin install/load on critical source scan fi...
by coygeek · 2026-02-07
81.0%
#7090: fix: plugin install uses manifest ID for folder name (#2796)
by dial481 · 2026-02-02
79.9%
#2556: fix(plugin-install): handle existing plugins and filter workspace deps
by longmaba · 2026-01-27
79.7%
#20424: Fix plugin extension path traversal in discovery/install
by markmusson · 2026-02-18
78.6%
#21660: fix(plugins): require explicit allowlist for non-bundled plugins
by AI-Reviewer-QS · 2026-02-20
77.7%