#18819: Improve skill scanner with additional dangerous pattern detection
stale
size: S
Title: Improve skill scanner with additional dangerous pattern detection
## Summary
Adds detection for several attack patterns that the current skill scanner misses:
- **Dynamic `import()` calls** that bypass static analysis of `require()` — attackers can load arbitrary modules at runtime
- **Prototype pollution** via `__proto__` and `constructor.prototype` manipulation — can modify Object behavior globally
- **Encoded payload execution** (base64 decode piped to eval/Function/setTimeout) — catches obfuscated code execution even with small payloads
- **Unicode-escaped string obfuscation** (`\uNNNN` sequences) — complements the existing hex-escape detection
## Motivation
While building [Samma Suit](https://sammasuit.com), a security governance framework for AI agents, we identified these patterns as common in supply chain attacks targeting plugin and skill ecosystems. The existing scanner catches direct `eval()` and `child_process` usage but misses indirect execution paths.
## Changes
**`src/security/skill-scanner.ts`**
- Added 2 new line rules: `dynamic-import` (warn), `prototype-pollution` (warn)
- Added 2 new source rules: `obfuscated-code` unicode variant (warn), `encoded-payload-execution` (critical)
**`src/security/skill-scanner.test.ts`**
- Added 10 test cases covering true positives and true negatives for each new pattern
- True negatives ensure no false positives on: static import declarations, normal Object.assign usage, standalone atob without eval, isolated unicode escapes in normal strings
## Testing
All 35 tests pass (23 existing + 12 new):
```
✓ src/security/skill-scanner.test.ts (35 tests) 74ms
Test Files 1 passed (1)
Tests 35 passed (35)
```
## Related
- Previous contribution: #10930 (WebSocket origin validation)
Most Similar PRs
#10705: security: extend skill scanner to detect threats in markdown skill ...
by Alex-Alaniz · 2026-02-06
75.7%
#10559: feat(security): add plugin output scanner for prompt injection dete...
by DukeDeSouth · 2026-02-06
75.5%
#13894: feat(security): add manifest scanner for SKILL.md trust analysis
by jdrhyne · 2026-02-11
75.1%
#13012: Security: detect invisible Unicode in skills and plugins (ASCII smu...
by agentwuzzi · 2026-02-10
74.7%
#10530: fix: tighten skill scanner false positives and add vm module detection
by abdelsfane · 2026-02-06
72.2%
#11032: fix(security): block plugin install/load on critical source scan fi...
by coygeek · 2026-02-07
70.9%
#17502: feat: normalize skill scanner reason codes and trust messaging
by ArthurzKV · 2026-02-15
70.6%
#8150: fix(skills): block dangerous environment variables from skill config
by yubrew · 2026-02-03
69.5%
#8075: fix(skills): add --ignore-scripts to all package managers
by yubrew · 2026-02-03
67.6%
#18107: fix(security): prevent ReDoS in session filter patterns (CWE-1333)
by brandonwise · 2026-02-16
66.8%