@guava-parity/guard-scanner 13.0.0 โ†’ 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +42 -253
  2. package/SECURITY.md +12 -4
  3. package/SKILL.md +121 -59
  4. package/dist/openclaw-plugin.mjs +41 -0
  5. package/docs/EVIDENCE_DRIVEN.md +182 -0
  6. package/docs/banner.png +0 -0
  7. package/docs/data/corpus-metrics.json +11 -0
  8. package/docs/data/latest.json +25837 -2481
  9. package/docs/generated/npm-audit-20260312.json +96 -0
  10. package/docs/generated/openclaw-upstream-status.json +25 -0
  11. package/docs/glossary.md +46 -0
  12. package/docs/index.html +1085 -496
  13. package/docs/logo.png +0 -0
  14. package/docs/openclaw-compatibility-audit.md +44 -0
  15. package/docs/openclaw-continuous-compatibility-plan.md +36 -0
  16. package/docs/rules/a2a-contagion.md +68 -0
  17. package/docs/rules/advanced-exfil.md +52 -0
  18. package/docs/rules/agent-protocol.md +108 -0
  19. package/docs/rules/api-abuse.md +68 -0
  20. package/docs/rules/autonomous-risk.md +92 -0
  21. package/docs/rules/config-impact.md +132 -0
  22. package/docs/rules/credential-handling.md +100 -0
  23. package/docs/rules/cve-patterns.md +332 -0
  24. package/docs/rules/data-exposure.md +84 -0
  25. package/docs/rules/exfiltration.md +36 -0
  26. package/docs/rules/financial-access.md +84 -0
  27. package/docs/rules/identity-hijack.md +140 -0
  28. package/docs/rules/inference-manipulation.md +60 -0
  29. package/docs/rules/leaky-skills.md +52 -0
  30. package/docs/rules/malicious-code.md +108 -0
  31. package/docs/rules/mcp-security.md +148 -0
  32. package/docs/rules/memory-poisoning.md +84 -0
  33. package/docs/rules/model-poisoning.md +44 -0
  34. package/docs/rules/obfuscation.md +60 -0
  35. package/docs/rules/persistence.md +108 -0
  36. package/docs/rules/pii-exposure.md +116 -0
  37. package/docs/rules/prompt-injection.md +148 -0
  38. package/docs/rules/prompt-worm.md +44 -0
  39. package/docs/rules/safeguard-bypass.md +44 -0
  40. package/docs/rules/sandbox-escape.md +100 -0
  41. package/docs/rules/secret-detection.md +44 -0
  42. package/docs/rules/supply-chain-v2.md +92 -0
  43. package/docs/rules/suspicious-download.md +60 -0
  44. package/docs/rules/trust-boundary.md +76 -0
  45. package/docs/rules/trust-exploitation.md +92 -0
  46. package/docs/rules/unverifiable-deps.md +84 -0
  47. package/docs/rules/vdb-injection.md +84 -0
  48. package/docs/security-vulnerability-report-20260312.md +53 -0
  49. package/docs/spec/PRD_V2_ARCHITECTURE.md +55 -0
  50. package/docs/spec/capabilities.json +42 -0
  51. package/docs/spec/finding.schema.json +104 -0
  52. package/docs/spec/integration-manifest.md +39 -0
  53. package/docs/spec/sbom.json +33 -0
  54. package/docs/threat-model.md +65 -0
  55. package/docs/v13-architecture-manifest.md +55 -0
  56. package/hooks/context.js +305 -0
  57. package/hooks/guard-scanner/plugin.ts +24 -1
  58. package/openclaw-plugin.mts +91 -0
  59. package/openclaw.plugin.json +30 -53
  60. package/package.json +23 -8
  61. package/src/cli.js +174 -34
  62. package/src/core/content-loader.js +42 -0
  63. package/src/core/inventory.js +73 -0
  64. package/src/core/report-adapters.js +171 -0
  65. package/src/core/risk-engine.js +93 -0
  66. package/src/core/rule-registry.js +73 -0
  67. package/src/core/semantic-validators.js +85 -0
  68. package/src/finding-schema.js +191 -0
  69. package/src/hooks/context.ts +49 -0
  70. package/src/html-template.js +2 -2
  71. package/src/mcp-server.js +24 -73
  72. package/src/openclaw-upstream.js +128 -0
  73. package/src/patterns.js +371 -353
  74. package/src/policy-engine.js +32 -0
  75. package/src/runtime-guard.js +40 -2
  76. package/src/scanner.js +101 -216
  77. package/src/skill-crawler.js +254 -0
  78. package/src/threat-model.js +50 -0
  79. package/src/validation-layer.js +39 -0
package/README.md CHANGED
@@ -1,72 +1,50 @@
1
1
  <p align="center">
2
- <img src="docs/banner.png" alt="guard-scanner banner" width="720" />
2
+ <img src="docs/logo.png" alt="guard-scanner" width="180" />
3
3
  </p>
4
4
 
5
5
  <h1 align="center">guard-scanner ๐Ÿ›ก๏ธ</h1>
6
- <p align="center"><strong>VirusTotal for AI Agent Skills</strong></p>
7
- <p align="center">The first open-source security scanner purpose-built for AI agent skill marketplaces.<br/>23 threat categories ยท 166 static patterns ยท 26 runtime checks ยท MCP server ยท asset audit ยท VirusTotal ยท zero dependencies.</p>
6
+ <p align="center"><strong>Security policy and runtime layer for agent skills and MCP workflows</strong></p>
7
+ <p align="center">35 threat categories ยท 358 static patterns ยท 27 runtime checks ยท 0 runtime dependencies</p>
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://www.npmjs.com/package/@guava-parity/guard-scanner"><img src="https://img.shields.io/npm/v/@guava-parity/guard-scanner?color=cb3837" alt="npm version" /></a>
11
- <a href="#test-results"><img src="https://img.shields.io/badge/tests-225%2F225-brightgreen" alt="tests" /></a>
12
- <a href="LICENSE"><img src="https://img.shields.io/npm/l/guard-scanner" alt="license" /></a>
13
- <a href="https://github.com/koatora20/guard-scanner"><img src="https://img.shields.io/badge/dependencies-0-blue" alt="zero deps" /></a>
14
- <a href="https://github.com/koatora20/dual-shield-paper"><img src="https://img.shields.io/badge/paper-36_pages-purple" alt="research paper" /></a>
11
+ <a href="#test-results"><img src="https://img.shields.io/badge/tests-332%20passed-brightgreen" alt="tests" /></a>
12
+ <a href="https://github.com/koatora20/guard-scanner/actions/workflows/codeql.yml"><img src="https://img.shields.io/badge/CodeQL-enabled-181717" alt="CodeQL" /></a>
13
+ <a href="https://doi.org/10.5281/zenodo.18906684"><img src="https://img.shields.io/badge/DOI-3_papers-purple" alt="DOI" /></a>
15
14
  </p>
16
15
 
17
16
  ---
18
17
 
19
- ## Why guard-scanner?
18
+ ## What is guard-scanner?
20
19
 
21
- Traditional security tools like VirusTotal are great at catching malware โ€” but they **can't see threats that live in natural language**. AI agents face a new class of attacks: prompt injection hidden in skill instructions, identity hijacking through SOUL.md overwrites, memory poisoning via crafted conversations. guard-scanner catches what others miss.
20
+ **guard-scanner** is an uncompromising security and policy enforcement layer designed specifically for AI agents, OpenClaw skills, and MCP (Model Context Protocol) workflows.
22
21
 
23
- ### What guard-scanner catches that others can't
22
+ While traditional security tools detect malware, AI agents face unique attack vectors: prompt injections hidden in memory, identity hijacking, autonomous permission escalation, and agent-to-agent contagion.
24
23
 
25
- | Threat Class | guard-scanner | VirusTotal | Snyk Agent Scan | Garak (NVIDIA) |
26
- |---|:---:|:---:|:---:|:---:|
27
- | Prompt Injection in Skills | โœ… | โŒ | โœ… | โœ… (LLM-level) |
28
- | Identity Hijacking (SOUL.md) | โœ… | โŒ | โŒ | โŒ |
29
- | Memory Poisoning | โœ… | โŒ | โŒ | โŒ |
30
- | Agent-to-Agent Worm | โœ… | โŒ | โŒ | โŒ |
31
- | Trust Exploitation | โœ… | โŒ | โŒ | โŒ |
32
- | MCP Tool Poisoning | โœ… | โŒ | โœ… | โŒ |
33
- | VDB Injection (CVE-2026-26030) | โœ… | โŒ | โŒ | โŒ |
34
- | Known Malware Signatures | โœ… (via VT) | โœ… | โŒ | โŒ |
35
- | Zero Dependencies | โœ… | N/A | โŒ | โŒ |
36
- | MCP Server Built-in | โœ… | โŒ | โŒ | โŒ |
37
- | Research Paper (36p) | โœ… | N/A | โŒ | โŒ |
24
+ **Core advantages:**
25
+ - **Zero Runtime Dependencies:** Ultra-lightweight npm dual-publish (Only `ws` is used for MCP).
26
+ - **Deep Defense:** Combines *static policy scanning* (358 patterns) with *runtime hook inspection* (27 checks).
27
+ - **Universal MCP Server:** Plugs instantly into Cursor, Windsurf, Claude Code, and OpenClaw.
28
+ - **Evidence-Driven Claims:** 100% precision/recall on our benchmark. 332 end-to-end tests all passing.
38
29
 
39
- > ๐Ÿ“„ **Backed by research**: [Dual-Shield Architecture paper](https://github.com/koatora20/dual-shield-paper) โ€” 28 days of production evidence, peer-review submitted.
30
+ > ๐Ÿ“„ **Backed by research**: Designed as the defense layer of the [The Sanctuary Protocol](https://doi.org/10.5281/zenodo.18906684) architecture (3-paper series, CC BY 4.0).
40
31
 
41
32
  ---
42
33
 
43
34
  ## Quick Start
44
35
 
36
+ ### 1. Zero-Install CLI Scan
37
+ Run a semantic security scan on your agent workspace instantly:
45
38
  ```bash
46
- # Run without installing (npx)
47
- npx -y @guava-parity/guard-scanner ./my-skills/
48
-
49
- # Or install globally
50
- npm install -g @guava-parity/guard-scanner
51
- guard-scanner ./my-skills/ --verbose
39
+ npx -y @guava-parity/guard-scanner ./my-skills/ --strict
52
40
  ```
53
41
 
54
- **That's it.** No config files, no API keys, no setup. Zero dependencies means zero supply chain risk.
55
-
56
- ## ๐Ÿ”Œ MCP Server (V9+)
57
-
58
- **Use guard-scanner as an MCP server** in any AI editor โ€” Cursor, Windsurf, Cline, Antigravity, Claude Code, OpenClaw. Zero-dependency stdio JSON-RPC 2.0. No API keys needed.
59
-
42
+ ### 2. Universal MCP Server
43
+ Connect guard-scanner to your favorite AI IDE for real-time security checking:
60
44
  ```bash
61
- # Start as MCP server
62
- guard-scanner serve
63
-
64
- # Or use directly via npx (no install required)
65
45
  npx -y @guava-parity/guard-scanner serve
66
46
  ```
67
-
68
- Add to your editor's MCP config:
69
-
47
+ *Configure your editor (e.g., `mcp_servers.json`):*
70
48
  ```json
71
49
  {
72
50
  "mcpServers": {
@@ -78,238 +56,49 @@ Add to your editor's MCP config:
78
56
  }
79
57
  ```
80
58
 
81
- | Config File | Editor |
82
- |---|---|
83
- | `.cursor/mcp.json` | Cursor |
84
- | `mcp_config.json` | OpenClaw |
85
- | `.windsurf/mcp.json` | Windsurf |
86
- | `cline_mcp_settings.json` | Cline / Roo Code |
87
- | `mcp_servers.json` | Claude Code |
88
-
89
- ### MCP Tools
90
-
91
- | Tool | Description |
92
- |------|-------------|
93
- | `scan_skill` | Scan a directory โ€” 166 patterns, 23 categories |
94
- | `scan_text` | Scan a code snippet inline |
95
- | `check_tool_call` | Runtime guard โ€” block dangerous tool calls before execution (26 checks, 5 layers) |
96
- | `audit_assets` | Audit npm/GitHub assets for exposure |
97
- | `get_stats` | Get scanner capabilities and statistics |
98
-
99
59
  ---
100
60
 
101
- ## ๐Ÿ–ฅ๏ธ MCP Server (v9 โ€” NEW!)
102
-
103
- Run guard-scanner as an **MCP server** for any AI editor (Cursor, Antigravity, Cline, Windsurf).
104
-
105
- ```bash
106
- # Start MCP server (stdio)
107
- npx -y @guava-parity/guard-scanner serve
108
- ```
61
+ ## Core Capabilities
109
62
 
110
- **5 tools available via MCP:**
111
- | Tool | Description |
112
- |------|-------------|
113
- | `scan_skill` | Scan a skill directory for threats |
114
- | `scan_text` | Scan raw text for prompt injection |
115
- | `check_tool_call` | Validate a tool call before execution |
116
- | `audit_assets` | Audit npm/GitHub/ClawHub assets |
117
- | `get_stats` | Get scanner stats and version info |
63
+ ### Threat Detection (35 Categories, 358 Patterns)
64
+ Detects advanced 2026-era agentic threats globally mapping to **OWASP ASI01-10**:
65
+ - **Prompt Injection & Memory Poisoning:** Detects invisible Unicode homoglyphs, decoding evasion, and payload cascades.
66
+ - **Agent Identity Hijacking:** Blocks SOUL.md overwrites and prevents identity death.
67
+ - **Autonomy & Privilege Escalation:** Rejects unauthorized `child_process`, `eval()`, and raw reverse shells.
68
+ - **A2A Contagion:** Halts Session Smuggling and lateral infection between chained agents.
118
69
 
119
- **Add to your editor's MCP config:**
120
- ```json
121
- {
122
- "mcpServers": {
123
- "guard-scanner": {
124
- "command": "npx",
125
- "args": ["-y", "@guava-parity/guard-scanner", "serve"]
126
- }
127
- }
128
- }
129
- ```
70
+ ### Advanced Runtime Guard
71
+ A deep `before_tool_call` layer validated seamlessly against OpenClaw `v2026.3.8`. Implements a ContextCrush 185KB gate and blocks Moltbook injection attempts during execution.
130
72
 
131
73
  ---
132
74
 
133
- ## ๐Ÿ”Ž Asset Audit (v6+)
134
-
135
- Audit your npm packages, GitHub repos, and ClawHub skills for leaked credentials and security exposure.
75
+ ## Usage Scenarios
136
76
 
77
+ **Audit Local Assets:**
137
78
  ```bash
79
+ # Audit npm, GitHub, or ClawHub exposures globally
138
80
  guard-scanner audit npm <username> --verbose
139
- guard-scanner audit github <username> --format json
140
- guard-scanner audit clawhub <query>
141
- guard-scanner audit all <username> --verbose
142
81
  ```
143
82
 
144
- ## ๐Ÿฆ  VirusTotal Integration (v7+)
145
-
146
- Combine guard-scanner's semantic detection with VirusTotal's 70+ antivirus engines for **Double-Layered Defense**.
147
-
148
- | Layer | Engine | Focus |
149
- |---|---|---|
150
- | **Semantic** | guard-scanner | Prompt injection, memory poisoning, supply chain |
151
- | **Signature** | VirusTotal | Known malware, trojans, C2 infrastructure |
152
-
153
- ```bash
154
- export VT_API_KEY=your-api-key-here
155
- guard-scanner scan ./skills/ --vt-scan
83
+ **Continuous CI/CD Security:**
84
+ ```yaml
85
+ # GitHub Actions integration
86
+ - name: Scan AI Workflows
87
+ run: npx -y @guava-parity/guard-scanner ./skills/ --format sarif --fail-on-findings > report.sarif
156
88
  ```
157
89
 
158
- > VT is optional โ€” guard-scanner works fully without it. Free tier: 4 req/min, 500/day.
159
-
160
- ## ๐Ÿ‘๏ธ Real-time Watch (v8+)
161
-
90
+ **Real-Time Live Reload Watcher:**
162
91
  ```bash
163
92
  guard-scanner watch ./skills/ --strict --soul-lock
164
93
  ```
165
94
 
166
- ## ๐Ÿ“Š CI/CD Integration (v8+)
167
-
168
- | Platform | Format |
169
- |---|---|
170
- | GitHub Actions | SARIF + `::error` annotations |
171
- | GitLab | Code Quality JSON |
172
- | Any | Webhook (HTTPS POST) |
173
-
174
- ```yaml
175
- # .github/workflows/security.yml
176
- - name: Scan AI skills
177
- run: npx -y @guava-parity/guard-scanner ./skills/ --format sarif --fail-on-findings > report.sarif
178
- - uses: github/codeql-action/upload-sarif@v3
179
- with:
180
- sarif_file: report.sarif
181
- ```
182
-
183
95
  ---
184
96
 
185
- ## Threat Categories (23)
186
-
187
- | # | Category | Detects |
188
- |---|----------|---------|
189
- | 1 | Prompt Injection | Hidden instructions, invisible Unicode, homoglyphs |
190
- | 2 | Malicious Code | `eval()`, `child_process`, reverse shells |
191
- | 3 | Suspicious Downloads | `curl\|bash`, executable downloads |
192
- | 4 | Credential Handling | `.env` reads, SSH keys |
193
- | 5 | Secret Detection | Hardcoded API keys, Shannon entropy |
194
- | 6 | Exfiltration | webhook.site, DNS tunneling |
195
- | 7 | Unverifiable Deps | Remote dynamic imports |
196
- | 8 | Financial Access | Crypto transactions |
197
- | 9 | Obfuscation | Base64โ†’exec, hex encoding |
198
- | 10 | Prerequisites Fraud | Fake download instructions |
199
- | 11 | Leaky Skills | Secrets in memory |
200
- | 12 | Memory Poisoning โšฟ | SOUL.md modification |
201
- | 13 | Prompt Worm | Self-replicating prompts |
202
- | 14 | Persistence | Cron, launchd |
203
- | 15 | CVE Patterns | CVE-2026-2256/25046/25253/25905/27825 |
204
- | 16 | MCP Security | Tool poisoning, SSRF, shadow servers |
205
- | 17 | Identity Hijacking โšฟ | Persona swap, memory wipe |
206
- | 18 | Config Impact | OpenClaw config writes |
207
- | 19 | PII Exposure | CC/SSN, Shadow AI calls |
208
- | 20 | Trust Exploitation | Authority claims, fake audits |
209
- | 21 | VDB Injection | Vector DB poisoning |
210
- | 22 | Sandbox Validation | Dangerous binaries, broad file scope |
211
- | 23 | Code Complexity | Deep nesting, eval/exec density |
212
-
213
- > โšฟ = Requires `--soul-lock` flag
214
-
215
- ## Runtime Guard (26 checks)
216
-
217
- Real-time `before_tool_call` hook across 5 defense layers.
218
-
219
- | Layer | Focus |
220
- |-------|-------|
221
- | 1. Threat Detection | Reverse shell, curl\|bash, SSRF |
222
- | 2. Trust Defense | SOUL.md tampering, memory injection |
223
- | 3. Safety Judge | Prompt injection in tool args |
224
- | 4. Behavioral | No-research execution detection |
225
- | 5. Trust Exploitation | Authority claim, creator bypass |
226
-
227
- ## Options
228
-
229
- | Flag | Description |
230
- |------|-------------|
231
- | `--verbose`, `-v` | Detailed findings |
232
- | `--strict` | Lower thresholds (more sensitive) |
233
- | `--check-deps` | Scan `package.json` dependencies |
234
- | `--soul-lock` | Agent identity protection |
235
- | `--vt-scan` | VirusTotal integration |
236
- | `--json` / `--sarif` / `--html` | Report format |
237
- | `--format json\|sarif` | Print to stdout (pipeable) |
238
- | `--quiet` | Suppress text output |
239
- | `--fail-on-findings` | Exit 1 on findings (CI/CD) |
240
- | `--rules <file>` | Custom rules (JSON) |
241
- | `--plugin <file>` | Load plugin module |
242
-
243
- ---
244
-
245
- ## Test Results
246
-
247
- ```
248
- โ„น tests 225
249
- โ„น suites 50
250
- โ„น pass 225
251
- โ„น fail 0
252
- โ„น duration_ms 373
253
- ```
254
-
255
- <details>
256
- <summary>Full test breakdown (50 suites)</summary>
257
-
258
- | Suite | Tests |
259
- |-------|-------|
260
- | Malicious Skill Detection | 16 โœ… |
261
- | Clean Skill (False Positive) | 2 โœ… |
262
- | Risk Score / Verdict | 10 โœ… |
263
- | Output Formats (JSON/SARIF/HTML) | 4 โœ… |
264
- | Pattern DB (166 patterns, 23 cats) | 4 โœ… |
265
- | IoC Database | 5 โœ… |
266
- | Shannon Entropy | 2 โœ… |
267
- | Plugin API / Custom Rules | 2 โœ… |
268
- | Skill Manifest | 4 โœ… |
269
- | Code Complexity | 2 โœ… |
270
- | Config / PII / OWASP | 26 โœ… |
271
- | Runtime Guard (5 layers) | 25 โœ… |
272
- | CVE Detection | 5 โœ… |
273
- | Asset Audit (npm/GitHub/ClawHub) | 32 โœ… |
274
- | VirusTotal Integration | 20 โœ… |
275
- | Watcher + CI/CD | 15 โœ… |
276
- | MCP Server | 19 โœ… |
277
-
278
- </details>
279
-
280
- ## Plugin API
281
-
282
- ```javascript
283
- module.exports = {
284
- name: 'my-plugin',
285
- patterns: [
286
- { id: 'MY_01', cat: 'custom', regex: /dangerous_pattern/g, severity: 'HIGH', desc: 'Description', all: true }
287
- ]
288
- };
289
- ```
290
-
291
- ```bash
292
- guard-scanner ./skills/ --plugin ./my-plugin.js
293
- ```
294
-
295
97
  ## Contributing
98
+ We welcome bug reports, new pattern ideas, and test case contributions. We hold a **Zero-Tolerance for Marketing Claims** โ€” all features must be reproducible and test-backed.
296
99
 
297
- We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
298
-
299
- **Quick ways to contribute:**
300
- - ๐Ÿ› Report bugs or false positives
301
- - ๐Ÿ›ก๏ธ Add new threat detection patterns
302
- - ๐Ÿ“– Improve documentation
303
- - ๐Ÿงช Add test cases for edge cases
304
-
305
- ## Research
306
-
307
- This project is backed by a peer-reviewed research paper:
308
-
309
- > **Dual-Shield Architecture for AI Agent Security and Memory Reliability**
310
- > dee & Guava โ€” Guava Parity Institute, March 2026
311
- > [GitHub](https://github.com/koatora20/dual-shield-paper) ยท [PDF](https://github.com/koatora20/dual-shield-paper/blob/main/paper/main.pdf)
100
+ - [Governance & Contribution](CONTRIBUTING.md)
101
+ - [Security Policy](SECURITY.md)
312
102
 
313
103
  ## License
314
-
315
104
  MIT โ€” [Guava Parity Institute](https://github.com/koatora20/guard-scanner)
package/SECURITY.md CHANGED
@@ -10,6 +10,13 @@ If you discover a security vulnerability in guard-scanner itself, please report
10
10
 
11
11
  We will respond within 48 hours and provide a fix within 7 days for critical issues.
12
12
 
13
+ ## Supported Versions
14
+
15
+ | Version | Status |
16
+ |---------|--------|
17
+ | Latest major (`14.x`) | โœ… Supported |
18
+ | Older releases | โš ๏ธ Best effort only |
19
+
13
20
  ## Scope
14
21
 
15
22
  guard-scanner is a **static analysis tool** โ€” it reads files but never executes them. It does not:
@@ -22,11 +29,12 @@ The only files guard-scanner writes are output reports (`--json`, `--sarif`, `--
22
29
 
23
30
  ## Supply Chain Security
24
31
 
25
- guard-scanner itself has **zero runtime dependencies**. This is a deliberate design choice:
26
- - Nothing to audit
27
- - No transitive dependency risks
32
+ guard-scanner itself keeps runtime dependencies intentionally small. As of `14.0.0`, it ships with **one runtime dependency** (`ws`) to support the MCP server.
33
+
34
+ - Small runtime surface area
28
35
  - No `postinstall` scripts
29
- - Pure Node.js stdlib
36
+ - SBOM generated in CI/release
37
+ - Provenance-enabled npm publish
30
38
 
31
39
  ## Pattern Updates
32
40
 
package/SKILL.md CHANGED
@@ -1,91 +1,153 @@
1
1
  ---
2
2
  name: guard-scanner
3
- description: "AI agent security platform. 166 static patterns + 26 runtime checks + npm/GitHub/ClawHub asset audit + VirusTotal integration + real-time file watch. Zero dependencies, 0.016ms/scan."
4
- metadata:
5
- clawdbot:
6
- homepage: "https://github.com/koatora20/guard-scanner"
7
- requires:
8
- env:
9
- VT_API_KEY: "Optional. VirusTotal API key for --vt-scan (free at virustotal.com)"
10
- files:
11
- - "dist/*"
12
- - "src/*"
13
- - "hooks/*"
14
- - "openclaw.plugin.json"
3
+ description: "Security scanner and runtime guard for AI agent skills. 358 static threat patterns across 35 categories + 27 runtime checks (5 defense layers). Use when scanning skill directories for security threats, auditing npm/GitHub/ClawHub assets for leaked credentials, running real-time file watch during development, integrating security checks into CI/CD pipelines (SARIF/JSON), setting up MCP server for editor-integrated scanning (Cursor, Windsurf, Claude Code, OpenClaw), or runtime guarding tool calls via the OpenClaw v2026.3.8 before_tool_call hook. Single dependency (ws). MIT licensed."
4
+ license: MIT
5
+ metadata: {"openclaw": {"requires": {"bins": ["node"]}}}
15
6
  ---
16
7
 
17
- # guard-scanner ๐Ÿ›ก๏ธ
8
+ # guard-scanner
18
9
 
19
- 166 static patterns + 26 runtime checks (5 layers), 23 threat categories + asset audit + VirusTotal + real-time watch. Zero deps, MIT licensed.
20
-
21
- ## When To Use
22
-
23
- - Before installing a new skill / After updating skills / In CI/CD pipelines
24
- - Auditing npm/GitHub/ClawHub for leaked credentials
25
- - Real-time monitoring during development
10
+ Scan AI agent skills for 35 categories of threats. Detect prompt injection, identity hijacking, memory poisoning, MCP tool poisoning, supply chain attacks, and 27 more threat classes that traditional security tools miss.
26
11
 
27
12
  ## Quick Start
28
13
 
29
14
  ```bash
30
- # Scan all skills
31
- npx guard-scanner ~/.openclaw/workspace/skills/ --verbose --self-exclude
15
+ # Scan a skill directory
16
+ npx -y @guava-parity/guard-scanner ./my-skills/ --verbose
32
17
 
33
- # Asset Audit (check npm/GitHub for leaks)
34
- guard-scanner audit npm <your-npm-username> --verbose
35
- guard-scanner audit github <your-github-username> --format json
36
- guard-scanner audit all <username>
18
+ # Scan with identity protection
19
+ npx -y @guava-parity/guard-scanner ./skills/ --soul-lock --strict
20
+ ```
37
21
 
38
- # VirusTotal Double-Layered Defense (optional, free)
39
- VT_API_KEY=your-key guard-scanner scan ./skills/ --vt-scan
22
+ ## Core Commands
40
23
 
41
- # Real-time Watch Mode
42
- guard-scanner watch ./skills/ --strict --verbose
24
+ ### Scan
43
25
 
44
- # CI/CD pipeline
45
- guard-scanner ./skills/ --format sarif --quiet | upload-sarif
26
+ ```bash
27
+ guard-scanner scan <dir> # Scan directory
28
+ guard-scanner scan <dir> -v # Verbose output
29
+ guard-scanner scan <dir> --json # JSON output
30
+ guard-scanner scan <dir> --sarif # SARIF for CI/CD
31
+ guard-scanner scan <dir> --html # HTML report
46
32
  ```
47
33
 
48
- ## VirusTotal Integration
34
+ ### Asset Audit
35
+
36
+ Audit public registries for credential exposure.
37
+
38
+ ```bash
39
+ guard-scanner audit npm <username>
40
+ guard-scanner audit github <username>
41
+ guard-scanner audit clawhub <query>
42
+ guard-scanner audit all <username> --verbose
43
+ ```
49
44
 
50
- guard-scanner combines its own 166 semantic patterns with VirusTotal's 70+ antivirus engines for **Double-Layered Defense**:
45
+ ### MCP Server
51
46
 
52
- | Layer | Engine | Focus |
53
- |---|---|---|
54
- | Semantic | guard-scanner | Prompt injection, memory poisoning, supply chain |
55
- | Signature | VirusTotal | Known malware, trojans, C2 infrastructure |
47
+ Start as MCP server for IDE integration.
56
48
 
57
49
  ```bash
58
- # Get your free API key at https://www.virustotal.com
59
- # Set it as environment variable
60
- export VT_API_KEY=your-api-key-here
50
+ guard-scanner serve
51
+ ```
61
52
 
62
- # Use with any command
63
- guard-scanner scan ./skills/ --vt-scan
64
- guard-scanner audit npm koatora20 --vt-scan
53
+ Editor config (Cursor, Windsurf, Claude Code, OpenClaw):
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "guard-scanner": {
59
+ "command": "npx",
60
+ "args": ["-y", "@guava-parity/guard-scanner", "serve"]
61
+ }
62
+ }
63
+ }
65
64
  ```
66
65
 
67
- Free tier: 4 req/min, 500/day, 15,500/month. VT is **optional** โ€” guard-scanner works fully without it.
66
+ MCP tools: `scan_skill`, `scan_text`, `check_tool_call`, `audit_assets`, `get_stats`.
68
67
 
69
- ## Runtime Modes
68
+ ### Watch Mode
70
69
 
71
- | Mode | Behavior |
72
- |------|----------|
73
- | `monitor` | Log all, never block |
74
- | `enforce` (default) | Block CRITICAL |
75
- | `strict` | Block HIGH + CRITICAL |
70
+ Monitor skill directories in real-time during development.
76
71
 
77
- ## 23 Threat Categories
72
+ ```bash
73
+ guard-scanner watch ./skills/ --strict --soul-lock
74
+ ```
78
75
 
79
- Prompt Injection, Malicious Code, Suspicious Downloads, Credential Handling, Secret Detection, Exfiltration, Unverifiable Deps, Financial Access, Obfuscation, Prerequisites Fraud, Leaky Skills, Memory Poisoning*, Prompt Worm, Persistence, CVE Patterns, MCP Security, Identity Hijacking*, Sandbox Validation, Code Complexity, Config Impact, PII Exposure, Trust Exploitation, VDB Injection.
76
+ ### VirusTotal Integration
80
77
 
81
- \* = Requires `--soul-lock` flag
78
+ Combine semantic detection with VirusTotal's 70+ antivirus engines. Optional โ€” guard-scanner works fully without it.
82
79
 
83
- ## Security & Privacy
80
+ ```bash
81
+ export VT_API_KEY=your-key
82
+ guard-scanner scan ./skills/ --vt-scan
83
+ ```
84
+
85
+ ## Runtime Guard
86
+
87
+ The validated OpenClaw surface is the compiled runtime plugin entry (`dist/openclaw-plugin.mjs`) discovered through `package.json > openclaw.extensions` and mounted on `before_tool_call` for OpenClaw `v2026.3.8`.
88
+
89
+ The `before_tool_call` hook provides 27 runtime checks across 5 defense layers:
90
+
91
+ | Layer | Focus |
92
+ |-------|-------|
93
+ | 1. Threat Detection | Reverse shell, curl\|bash, SSRF |
94
+ | 2. Trust Defense | SOUL.md tampering, memory injection |
95
+ | 3. Safety Judge | Prompt injection in tool arguments |
96
+ | 4. Behavioral | No-research execution detection |
97
+ | 5. Trust Exploitation | Authority claims, creator bypass |
98
+
99
+ Modes: `monitor` (log only), `enforce` (block CRITICAL, default), `strict` (block HIGH+).
100
+
101
+ ## Key Flags
102
+
103
+ | Flag | Effect |
104
+ |------|--------|
105
+ | `--verbose` / `-v` | Detailed findings with line numbers |
106
+ | `--strict` | Lower detection thresholds |
107
+ | `--soul-lock` | Enable identity protection patterns |
108
+ | `--vt-scan` | Add VirusTotal double-layered check |
109
+ | `--json` / `--sarif` / `--html` | Output format |
110
+ | `--fail-on-findings` | Exit 1 on findings (CI/CD) |
111
+ | `--check-deps` | Scan package.json dependencies |
112
+ | `--rules <file>` | Load custom rules JSON |
113
+ | `--plugin <file>` | Load plugin module |
114
+
115
+ ## Custom Rules
116
+
117
+ ```javascript
118
+ module.exports = {
119
+ name: 'my-plugin',
120
+ patterns: [
121
+ { id: 'MY_01', cat: 'custom', regex: /dangerous_pattern/g, severity: 'HIGH', desc: 'Description', all: true }
122
+ ]
123
+ };
124
+ ```
125
+
126
+ ```bash
127
+ guard-scanner ./skills/ --plugin ./my-plugin.js
128
+ ```
129
+
130
+ ## CI/CD Integration
131
+
132
+ ```yaml
133
+ # .github/workflows/security.yml
134
+ - name: Scan AI skills
135
+ run: npx -y @guava-parity/guard-scanner ./skills/ --format sarif --fail-on-findings > report.sarif
136
+ - uses: github/codeql-action/upload-sarif@v3
137
+ with:
138
+ sarif_file: report.sarif
139
+ ```
84
140
 
85
- Zero network requests (unless `--vt-scan`). Read-only scanning. No telemetry. No env access. Deterministic. Your VT API key stays local.
141
+ ## Threat Categories
86
142
 
87
- ## Trust
143
+ 35 categories covering OWASP LLM Top 10 + Agentic Security Top 10. See `src/patterns.js` for the full pattern database. Key categories:
88
144
 
89
- Open source, zero deps, **206 tests / 43 suites** 100% pass. OWASP LLM Top 10 + Agentic Security Top 10 coverage.
145
+ - **Prompt Injection** โ€” hidden instructions, invisible Unicode, homoglyphs
146
+ - **Identity Hijacking** โšฟ โ€” persona swap, SOUL.md overwrites, memory wipe
147
+ - **Memory Poisoning** โšฟ โ€” crafted conversation injection
148
+ - **MCP Security** โ€” tool poisoning, SSRF, shadow servers
149
+ - **A2A Contagion** โ€” agent-to-agent worm propagation
150
+ - **Supply Chain V2** โ€” typosquatting, slopsquatting, lifecycle scripts
151
+ - **CVE Patterns** โ€” CVE-2026-2256, 25046, 25253, 25905, 27825
90
152
 
91
- MIT โ€” [LICENSE](LICENSE)
153
+ > โšฟ = Requires `--soul-lock` flag
@@ -0,0 +1,41 @@
1
+ import { createRequire } from "node:module";
2
+ const require = createRequire(import.meta.url);
3
+ const runtimeGuard = require("../src/runtime-guard.js");
4
+ function resolveMode(pluginConfig) {
5
+ const mode = pluginConfig?.mode;
6
+ if (mode === "monitor" || mode === "enforce" || mode === "strict") {
7
+ return mode;
8
+ }
9
+ return undefined;
10
+ }
11
+ function resolveAuditLog(pluginConfig) {
12
+ return pluginConfig?.auditLog !== false;
13
+ }
14
+ function beforeToolCall(event, ctx, api) {
15
+ const result = runtimeGuard.scanToolCall(event.toolName, event.params, {
16
+ mode: resolveMode(api.pluginConfig),
17
+ auditLog: resolveAuditLog(api.pluginConfig),
18
+ sessionKey: ctx.sessionKey,
19
+ sessionId: ctx.sessionId,
20
+ runId: ctx.runId ?? event.runId,
21
+ toolCallId: ctx.toolCallId ?? event.toolCallId,
22
+ agentId: ctx.agentId,
23
+ });
24
+ if (!result.blocked)
25
+ return;
26
+ return {
27
+ block: true,
28
+ blockReason: result.blockReason ?? "guard-scanner blocked the tool call.",
29
+ };
30
+ }
31
+ const plugin = {
32
+ id: "guard-scanner",
33
+ name: "guard-scanner",
34
+ version: "15.0.0",
35
+ description: "Runtime guard for OpenClaw before_tool_call hook execution.",
36
+ register(api) {
37
+ api.on("before_tool_call", (event, ctx) => beforeToolCall(event, ctx, api), { priority: 90 });
38
+ api.logger.info("guard-scanner registered OpenClaw before_tool_call hook (validated for v2026.3.8).");
39
+ },
40
+ };
41
+ export default plugin;