@guava-parity/guard-scanner 9.1.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.
- package/README.md +42 -253
- package/SECURITY.md +12 -4
- package/SKILL.md +121 -59
- package/dist/openclaw-plugin.mjs +41 -0
- package/docs/EVIDENCE_DRIVEN.md +182 -0
- package/docs/banner.png +0 -0
- package/docs/data/corpus-metrics.json +11 -0
- package/docs/data/latest.json +29845 -0
- package/docs/generated/npm-audit-20260312.json +96 -0
- package/docs/generated/openclaw-upstream-status.json +25 -0
- package/docs/glossary.md +46 -0
- package/docs/index.html +1119 -0
- package/docs/logo.png +0 -0
- package/docs/openclaw-compatibility-audit.md +44 -0
- package/docs/openclaw-continuous-compatibility-plan.md +36 -0
- package/docs/rules/a2a-contagion.md +68 -0
- package/docs/rules/advanced-exfil.md +52 -0
- package/docs/rules/agent-protocol.md +108 -0
- package/docs/rules/api-abuse.md +68 -0
- package/docs/rules/autonomous-risk.md +92 -0
- package/docs/rules/config-impact.md +132 -0
- package/docs/rules/credential-handling.md +100 -0
- package/docs/rules/cve-patterns.md +332 -0
- package/docs/rules/data-exposure.md +84 -0
- package/docs/rules/exfiltration.md +36 -0
- package/docs/rules/financial-access.md +84 -0
- package/docs/rules/identity-hijack.md +140 -0
- package/docs/rules/inference-manipulation.md +60 -0
- package/docs/rules/leaky-skills.md +52 -0
- package/docs/rules/malicious-code.md +108 -0
- package/docs/rules/mcp-security.md +148 -0
- package/docs/rules/memory-poisoning.md +84 -0
- package/docs/rules/model-poisoning.md +44 -0
- package/docs/rules/obfuscation.md +60 -0
- package/docs/rules/persistence.md +108 -0
- package/docs/rules/pii-exposure.md +116 -0
- package/docs/rules/prompt-injection.md +148 -0
- package/docs/rules/prompt-worm.md +44 -0
- package/docs/rules/safeguard-bypass.md +44 -0
- package/docs/rules/sandbox-escape.md +100 -0
- package/docs/rules/secret-detection.md +44 -0
- package/docs/rules/supply-chain-v2.md +92 -0
- package/docs/rules/suspicious-download.md +60 -0
- package/docs/rules/trust-boundary.md +76 -0
- package/docs/rules/trust-exploitation.md +92 -0
- package/docs/rules/unverifiable-deps.md +84 -0
- package/docs/rules/vdb-injection.md +84 -0
- package/docs/security-vulnerability-report-20260312.md +53 -0
- package/docs/spec/PRD_V2_ARCHITECTURE.md +55 -0
- package/docs/spec/capabilities.json +42 -0
- package/docs/spec/finding.schema.json +104 -0
- package/docs/spec/integration-manifest.md +39 -0
- package/docs/spec/sbom.json +33 -0
- package/docs/threat-model.md +65 -0
- package/docs/v13-architecture-manifest.md +55 -0
- package/hooks/context.js +305 -0
- package/hooks/guard-scanner/plugin.ts +24 -1
- package/openclaw-plugin.mts +91 -0
- package/openclaw.plugin.json +30 -53
- package/package.json +80 -57
- package/src/cli.js +174 -34
- package/src/core/content-loader.js +42 -0
- package/src/core/inventory.js +73 -0
- package/src/core/report-adapters.js +171 -0
- package/src/core/risk-engine.js +93 -0
- package/src/core/rule-registry.js +73 -0
- package/src/core/semantic-validators.js +85 -0
- package/src/finding-schema.js +191 -0
- package/src/hooks/context.ts +49 -0
- package/src/html-template.js +2 -2
- package/src/mcp-server.js +192 -5
- package/src/openclaw-upstream.js +128 -0
- package/src/patterns.js +519 -157
- package/src/policy-engine.js +32 -0
- package/src/runtime-guard.js +40 -2
- package/src/scanner.js +228 -231
- package/src/skill-crawler.js +254 -0
- package/src/threat-model.js +50 -0
- package/src/validation-layer.js +39 -0
package/README.md
CHANGED
|
@@ -1,72 +1,50 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="docs/
|
|
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>
|
|
7
|
-
<p align="center">
|
|
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-
|
|
12
|
-
<a href="
|
|
13
|
-
<a href="https://
|
|
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
|
-
##
|
|
18
|
+
## What is guard-scanner?
|
|
20
19
|
|
|
21
|
-
|
|
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
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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**: [
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
|
|
120
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
26
|
-
|
|
27
|
-
-
|
|
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
|
-
-
|
|
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
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
|
31
|
-
npx guard-scanner
|
|
15
|
+
# Scan a skill directory
|
|
16
|
+
npx -y @guava-parity/guard-scanner ./my-skills/ --verbose
|
|
32
17
|
|
|
33
|
-
#
|
|
34
|
-
guard-scanner
|
|
35
|
-
|
|
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
|
-
|
|
39
|
-
VT_API_KEY=your-key guard-scanner scan ./skills/ --vt-scan
|
|
22
|
+
## Core Commands
|
|
40
23
|
|
|
41
|
-
|
|
42
|
-
guard-scanner watch ./skills/ --strict --verbose
|
|
24
|
+
### Scan
|
|
43
25
|
|
|
44
|
-
|
|
45
|
-
guard-scanner
|
|
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
|
-
|
|
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
|
-
|
|
45
|
+
### MCP Server
|
|
51
46
|
|
|
52
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
export VT_API_KEY=your-api-key-here
|
|
50
|
+
guard-scanner serve
|
|
51
|
+
```
|
|
61
52
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
66
|
+
MCP tools: `scan_skill`, `scan_text`, `check_tool_call`, `audit_assets`, `get_stats`.
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
### Watch Mode
|
|
70
69
|
|
|
71
|
-
|
|
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
|
-
|
|
72
|
+
```bash
|
|
73
|
+
guard-scanner watch ./skills/ --strict --soul-lock
|
|
74
|
+
```
|
|
78
75
|
|
|
79
|
-
|
|
76
|
+
### VirusTotal Integration
|
|
80
77
|
|
|
81
|
-
|
|
78
|
+
Combine semantic detection with VirusTotal's 70+ antivirus engines. Optional — guard-scanner works fully without it.
|
|
82
79
|
|
|
83
|
-
|
|
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
|
-
|
|
141
|
+
## Threat Categories
|
|
86
142
|
|
|
87
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|