#11032: fix(security): block plugin install/load on critical source scan findings
stale
## Fix Summary
Add source code scanning at both plugin install and load time. The existing `skill-scanner.ts` module already detects dangerous patterns (child_process, eval/new Function, crypto mining, obfuscated code, env harvesting) but its findings were warn-only at install time and completely absent at load time.
Changes:
- **install.ts**: Make `scanDirectoryWithSummary()` blocking on critical findings (was warn-only). Add scanning to `installPluginFromFile()` which previously had zero checks. Add `skipScan` parameter for `--force` flag support.
- **loader.ts**: Add pre-load scanning before `jiti(candidate.source)` call. Block loading when critical findings detected.
## Issue Linkage
Fixes #11030
## Security Snapshot
| Metric | Value |
|--------|-------|
| **Score** | 9.6 / 10.0 |
| **Severity** | Critical |
| **Vector** | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H |
## Implementation Details
### Files Changed
- `src/plugins/install.ts` (+52/-3)
- `src/plugins/loader.ts` (+32/-0)
### Technical Analysis
Add source code scanning at both plugin install and load time. The existing `skill-scanner.ts` module already detects dangerous patterns (child_process, eval/new Function, crypto mining, obfuscated code, env harvesting) but its findings were warn-only at install time and completely absent at load time.
## Validation Evidence
- Command: `install.ts`
- Status: passed
## Risk and Compatibility
non-breaking; compatibility impact was not explicitly documented in the original PR body.
## AI-Assisted Disclosure
- AI-assisted: yes
- Model: Claude Code
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
- Tightens plugin security by making source scans blocking on *critical* findings during install (archive/dir/npm spec) with a `skipScan` escape hatch.
- Adds scanning for single-file plugin installs before copying into the extensions directory.
- Adds a pre-load source scan in the plugin loader to prevent `jiti()` execution when critical patterns are detected.
- Overall integrates the existing `skill-scanner` logic into both install-time and load-time plugin workflows to reduce arbitrary code execution risk.
<h3>Confidence Score: 3/5</h3>
- This PR is directionally correct but has a couple of concrete correctness issues that should be fixed before merging.
- The install/load blocking behavior appears consistent with the scanner’s severity model, but existing tests now contradict the new blocking semantics, and the loader’s scan-failure catch can crash when a provided logger lacks a warn method.
- src/plugins/loader.ts and src/plugins/install.test.ts
<!-- greptile_other_comments_section -->
**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
#10559: feat(security): add plugin output scanner for prompt injection dete...
by DukeDeSouth · 2026-02-06
82.1%
#8073: fix(plugins): add --ignore-scripts to npm install
by yubrew · 2026-02-03
81.0%
#17502: feat: normalize skill scanner reason codes and trust messaging
by ArthurzKV · 2026-02-15
81.0%
#11432: fix(security): add --ignore-scripts to npm install in hook and plug...
by coygeek · 2026-02-07
80.5%
#11439: fix(security): warn on relative OPENCLAW_CONFIG_PATH and disable co...
by coygeek · 2026-02-07
79.9%
#8075: fix(skills): add --ignore-scripts to all package managers
by yubrew · 2026-02-03
79.8%
#10705: security: extend skill scanner to detect threats in markdown skill ...
by Alex-Alaniz · 2026-02-06
79.3%
#13169: security: add --ignore-scripts to npm install during plugin/hook in...
by RamiNoodle733 · 2026-02-10
79.0%
#21660: fix(plugins): require explicit allowlist for non-bundled plugins
by AI-Reviewer-QS · 2026-02-20
78.6%
#2556: fix(plugin-install): handle existing plugins and filter workspace deps
by longmaba · 2026-01-27
78.3%