#14112: test(security): harden plugin install against script execution
stale
Cluster:
Plugin Management Enhancements
## Problem
Plugin installs should not execute dependency lifecycle scripts; issue #13132 asks for supply-chain hardening verification around `--ignore-scripts`.
## What changed
- Added an archive-install flow test that uses a local dependency with a `postinstall` script.
- Executed real install subprocesses in test via mocked command runner passthrough.
- Asserted that the postinstall marker file is never created during plugin archive install.
- Reset command mock state before existing dir-install test setup for isolation.
## Validation
- `pnpm exec vitest run src/plugins/install.test.ts`
- Result: pass (`12 passed`)
Fixes #13132
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Adds comprehensive security test to verify plugin archive installations don't execute dependency lifecycle scripts (addressing supply-chain hardening requirement from issue #13132). The test creates a local dependency with a `postinstall` script that writes a marker file via environment variable, executes real install subprocesses through mocked command runner passthrough, and asserts the marker file is never created. Also adds `mockReset()` to the existing directory install test for proper test isolation.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no issues found
- The test implementation is well-designed with proper isolation, environment cleanup, and directly verifies the security requirement. The addition of `mockReset()` to the existing test improves test reliability. No logical errors, security vulnerabilities, or syntax issues detected.
- No files require special attention
<!-- greptile_other_comments_section -->
<sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#8073: fix(plugins): add --ignore-scripts to npm install
by yubrew · 2026-02-03
85.2%
#13169: security: add --ignore-scripts to npm install during plugin/hook in...
by RamiNoodle733 · 2026-02-10
81.0%
#20424: Fix plugin extension path traversal in discovery/install
by markmusson · 2026-02-18
79.9%
#21964: Security: harden gateway and plugin trust boundaries
by Elormyevu · 2026-02-20
78.6%
#11032: fix(security): block plugin install/load on critical source scan fi...
by coygeek · 2026-02-07
78.3%
#2556: fix(plugin-install): handle existing plugins and filter workspace deps
by longmaba · 2026-01-27
78.2%
#11432: fix(security): add --ignore-scripts to npm install in hook and plug...
by coygeek · 2026-02-07
78.1%
#21660: fix(plugins): require explicit allowlist for non-bundled plugins
by AI-Reviewer-QS · 2026-02-20
77.5%
#3973: fix: enhance npm package integrity checks and include critical files
by YeSuX · 2026-01-29
77.5%
#20499: test(plugins): add bundled+config duplicate discovery regression
by dcol91863 · 2026-02-19
76.3%