@guava-parity/guard-scanner 15.0.0 → 16.0.1

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 (62) hide show
  1. package/README.md +221 -42
  2. package/README_ja.md +265 -0
  3. package/SKILL.md +46 -11
  4. package/dist/cli.cjs +5998 -0
  5. package/dist/cli.d.mts +1 -0
  6. package/dist/cli.d.ts +1 -0
  7. package/dist/cli.mjs +6004 -0
  8. package/dist/index.cjs +4826 -0
  9. package/dist/index.d.mts +17 -0
  10. package/dist/index.d.ts +17 -0
  11. package/dist/index.mjs +4799 -0
  12. package/dist/mcp-server.cjs +4757 -0
  13. package/dist/mcp-server.d.mts +1 -0
  14. package/dist/mcp-server.d.ts +1 -0
  15. package/dist/mcp-server.mjs +4768 -0
  16. package/dist/openclaw-plugin.cjs +4864 -0
  17. package/dist/openclaw-plugin.d.mts +11 -0
  18. package/dist/openclaw-plugin.d.ts +11 -0
  19. package/dist/openclaw-plugin.mjs +4848 -34
  20. package/dist/types.cjs +18 -0
  21. package/dist/types.d.mts +215 -0
  22. package/dist/types.d.ts +215 -0
  23. package/dist/types.mjs +1 -0
  24. package/docs/data/benchmark-ledger.json +1428 -0
  25. package/docs/data/corpus-metrics.json +3 -3
  26. package/docs/data/fp-ledger.json +18 -0
  27. package/docs/data/quality-contract.json +36 -0
  28. package/docs/generated/openclaw-upstream-status.json +13 -13
  29. package/docs/openclaw-compatibility-audit.md +3 -2
  30. package/docs/openclaw-continuous-compatibility-plan.md +2 -1
  31. package/docs/spec/capabilities.json +137 -5
  32. package/docs/spec/plugin-trust.json +11 -0
  33. package/guard-scanner +4 -0
  34. package/hooks/{context.js → context.ts} +1 -0
  35. package/openclaw-plugin.mts +21 -5
  36. package/openclaw.plugin.json +2 -2
  37. package/package.json +60 -21
  38. package/src/asset-auditor.js +0 -508
  39. package/src/ci-reporter.js +0 -135
  40. package/src/cli.js +0 -434
  41. package/src/core/content-loader.js +0 -42
  42. package/src/core/inventory.js +0 -73
  43. package/src/core/report-adapters.js +0 -171
  44. package/src/core/risk-engine.js +0 -93
  45. package/src/core/rule-registry.js +0 -73
  46. package/src/core/semantic-validators.js +0 -85
  47. package/src/finding-schema.js +0 -191
  48. package/src/hooks/context.ts +0 -49
  49. package/src/html-template.js +0 -239
  50. package/src/ioc-db.js +0 -54
  51. package/src/mcp-server.js +0 -653
  52. package/src/openclaw-upstream.js +0 -128
  53. package/src/patterns.js +0 -629
  54. package/src/policy-engine.js +0 -32
  55. package/src/quarantine.js +0 -41
  56. package/src/runtime-guard.js +0 -384
  57. package/src/scanner.js +0 -1042
  58. package/src/skill-crawler.js +0 -254
  59. package/src/threat-model.js +0 -50
  60. package/src/validation-layer.js +0 -39
  61. package/src/vt-client.js +0 -202
  62. package/src/watcher.js +0 -170
package/README.md CHANGED
@@ -1,51 +1,83 @@
1
1
  <p align="center">
2
- <img src="docs/logo.png" alt="guard-scanner" width="180" />
2
+ <img src="docs/logo.png" alt="guard-scanner" width="160" />
3
3
  </p>
4
4
 
5
- <h1 align="center">guard-scanner 🛡️</h1>
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>
5
+ <h1 align="center">guard-scanner</h1>
6
+ <p align="center"><strong>Security scanner for the agentic era.</strong></p>
7
+ <p align="center">
8
+ Detect prompt injection, identity hijacking, memory poisoning, and A2A contagion<br />
9
+ in AI agent skills, MCP servers, and autonomous workflows.
10
+ </p>
8
11
 
9
12
  <p align="center">
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-332%20passed-brightgreen" alt="tests" /></a>
13
+ <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&label=npm" alt="npm" /></a>
14
+ <a href="https://www.npmjs.com/package/@guava-parity/guard-scanner"><img src="https://img.shields.io/npm/dm/@guava-parity/guard-scanner?color=blue&label=downloads" alt="downloads" /></a>
15
+ <a href="#test-results"><img src="https://img.shields.io/badge/tests-363%20passed-brightgreen" alt="tests" /></a>
12
16
  <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>
17
+ <a href="https://doi.org/10.5281/zenodo.18906684"><img src="https://img.shields.io/badge/DOI-Zenodo-blue" alt="DOI" /></a>
18
+ <a href="https://github.com/koatora20/guard-scanner/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT" /></a>
19
+ </p>
20
+
21
+ <p align="center">
22
+ <strong>358</strong> detection patterns · <strong>35</strong> threat categories · <strong>27</strong> runtime checks · <strong>1</strong> dependency (<code>ws</code>)
14
23
  </p>
15
24
 
16
25
  ---
17
26
 
18
- ## What is guard-scanner?
27
+ Traditional security tools catch malware. **guard-scanner** catches what they miss: invisible Unicode injections hiding in agent instructions, identity theft through SOUL.md overwrites, memory poisoning via crafted conversations, and worm-like contagion spreading between chained agents.
19
28
 
20
- **guard-scanner** is an uncompromising security and policy enforcement layer designed specifically for AI agents, OpenClaw skills, and MCP (Model Context Protocol) workflows.
29
+ ```
30
+ $ npx @guava-parity/guard-scanner ./skills/ --strict --soul-lock --compliance owasp-asi
21
31
 
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.
32
+ guard-scanner v16.0.1
23
33
 
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.
34
+ ⚠ CRITICAL identity-hijack SOUL_OVERWRITE_ATTEMPT
35
+ skills/imported-tool/SKILL.md:47
36
+ Rationale: Direct overwrite of agent identity file detected.
37
+ Remediation: Remove this instruction; SOUL.md must be immutable.
29
38
 
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).
39
+ ⚠ HIGH prompt-injection INVISIBLE_UNICODE_INJECTION
40
+ skills/imported-tool/handler.js:12
41
+ Rationale: Invisible Unicode characters (U+200B) detected in instruction text.
42
+ Remediation: Strip zero-width characters and re-audit.
43
+
44
+ ✖ 2 findings (1 critical, 1 high) in 0.8s
45
+ ```
46
+
47
+ > 📄 Backed by a [3-paper research series](https://doi.org/10.5281/zenodo.18906684) (Zenodo, CC BY 4.0) — part of [The Sanctuary Protocol](https://github.com/koatora20/guard-scanner/blob/main/docs/THREAT_TAXONOMY.md) framework.
48
+
49
+ ---
50
+
51
+ ## Finding Schema
52
+
53
+ Every finding includes: `rule_id`, `category`, `severity`, `description`, `rationale`, `preconditions`, `false_positive_scenarios`, `remediation_hint`, `validation_status`, and `evidence`. Machine-readable contract: [`docs/spec/finding.schema.json`](docs/spec/finding.schema.json).
31
54
 
32
55
  ---
33
56
 
34
57
  ## Quick Start
35
58
 
36
- ### 1. Zero-Install CLI Scan
37
- Run a semantic security scan on your agent workspace instantly:
59
+ **Scan a directory** no install required:
60
+
38
61
  ```bash
39
62
  npx -y @guava-parity/guard-scanner ./my-skills/ --strict
63
+ npx -y @guava-parity/guard-scanner ./my-skills/ --compliance owasp-asi
64
+ ```
65
+
66
+ **Installed CLI**:
67
+
68
+ ```bash
69
+ npm install -g @guava-parity/guard-scanner
70
+ guard-scanner ./my-skills/ --strict
40
71
  ```
41
72
 
42
- ### 2. Universal MCP Server
43
- Connect guard-scanner to your favorite AI IDE for real-time security checking:
73
+ **Start as MCP server** — works with Cursor, Windsurf, Claude Code, OpenClaw:
74
+
44
75
  ```bash
45
76
  npx -y @guava-parity/guard-scanner serve
46
77
  ```
47
- *Configure your editor (e.g., `mcp_servers.json`):*
48
- ```json
78
+
79
+ ```jsonc
80
+ // Add to your editor's mcp_servers.json
49
81
  {
50
82
  "mcpServers": {
51
83
  "guard-scanner": {
@@ -56,49 +88,196 @@ npx -y @guava-parity/guard-scanner serve
56
88
  }
57
89
  ```
58
90
 
91
+ **Watch mode** — real-time scanning during development:
92
+
93
+ ```bash
94
+ guard-scanner watch ./skills/ --strict --soul-lock
95
+ ```
96
+
97
+ **v16 compliance projection** — filter findings to the OWASP Agentic Top 10 mapping:
98
+
99
+ ```bash
100
+ guard-scanner ./skills/ --compliance owasp-asi --format json
101
+ ```
102
+
103
+ **`npm exec` compatibility path**:
104
+
105
+ ```bash
106
+ npm exec --yes --package=@guava-parity/guard-scanner -- guard-scanner ./skills/ --strict
107
+ ```
108
+
109
+ ---
110
+
111
+ ## What It Detects
112
+
113
+ 35 threat categories organized across the full agentic attack surface:
114
+
115
+ | Category | Examples | Severity |
116
+ |----------|----------|----------|
117
+ | **Prompt Injection** | Invisible Unicode, homoglyphs, Base64 evasion, payload cascades | Critical |
118
+ | **Identity Hijacking** ⚿ | SOUL.md overwrite, persona swap, memory wipe commands | Critical |
119
+ | **A2A Contagion** | Session Smuggling, Lateral Propagation, Confused Deputy | Critical |
120
+ | **Memory Poisoning** ⚿ | Crafted conversation injection, VDB poisoning | High |
121
+ | **MCP Security** | Tool shadowing, SSRF via tool args, shadow server registration | High |
122
+ | **Sandbox Escape** | `child_process`, `eval()`, reverse shell, `curl\|bash` | High |
123
+ | **Supply Chain V2** | Typosquatting, slopsquatting, lifecycle script abuse | High |
124
+ | **CVE Patterns** | CVE-2026-2256, 25046, 25253, 25905, 27825 | High |
125
+ | **Data Exfiltration** | DNS tunneling, steganographic channels, staged uploads | Medium |
126
+ | **Credential Exposure** | API keys, tokens, `.env` files, hardcoded secrets | Medium |
127
+
128
+ > ⚿ = Requires `--soul-lock` flag. Full taxonomy: [docs/THREAT_TAXONOMY.md](docs/THREAT_TAXONOMY.md)
129
+
59
130
  ---
60
131
 
61
- ## Core Capabilities
132
+ ## Runtime Guard
133
+
134
+ guard-scanner v16 isn't just a static scanner — it exposes a 5-layer analysis pipeline across static scan, protocol analysis, runtime evidence, cognitive heuristics, and threat-intelligence overlays. It also provides a real-time **`before_tool_call`** hook that intercepts dangerous tool invocations during agent execution.
135
+
136
+ ### v16 Analysis Layers
62
137
 
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.
138
+ | Layer | Purpose |
139
+ |------|---------|
140
+ | 1. Static Analysis | Patterns, AST/data-flow signals, manifest and dependency checks |
141
+ | 2. Protocol Analysis | MCP, A2A, WebSocket, credential-flow, session-boundary findings |
142
+ | 3. Runtime Behavior | Runtime guard evidence plus Rust `memory_integrity` / `soul_hard_gate` signals |
143
+ | 4. Cognitive Threat Detection | Goal-drift, trust-bias, cascading handoff heuristics |
144
+ | 5. Threat Intelligence | Registry/provenance, machine identity, budget abuse, supply chain hints |
69
145
 
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.
146
+ Every v16 finding can now carry `layer`, `layer_name`, `owasp_asi`, and `protocol_surface` in JSON/MCP output.
147
+
148
+ | Defense Layer | What It Blocks |
149
+ |---------------|---------------|
150
+ | 1. Threat Detection | Reverse shell, `curl\|bash`, SSRF, raw code execution |
151
+ | 2. Trust Defense | SOUL.md tampering, unauthorized memory injection |
152
+ | 3. Safety Judge | Prompt injection embedded in tool arguments |
153
+ | 4. Behavioral Analysis | No-research execution, hallucination-driven actions |
154
+ | 5. Trust Exploitation | Authority claim attacks, creator impersonation |
155
+
156
+ **27 runtime checks** across 5 layers. Public compatibility is pinned to OpenClaw `v2026.3.8` for manifest/discovery/`before_tool_call`; newer upstream releases are tracked separately by the upstream drift watchdog.
157
+
158
+ Modes: `monitor` (log only) · `enforce` (block CRITICAL, default) · `strict` (block HIGH+)
72
159
 
73
160
  ---
74
161
 
75
- ## Usage Scenarios
162
+ ## Asset Audit
163
+
164
+ Discover leaked credentials and security exposures across public registries:
76
165
 
77
- **Audit Local Assets:**
78
166
  ```bash
79
- # Audit npm, GitHub, or ClawHub exposures globally
80
167
  guard-scanner audit npm <username> --verbose
168
+ guard-scanner audit github <username> --format json
169
+ guard-scanner audit clawhub <query>
170
+ guard-scanner audit all <username>
81
171
  ```
82
172
 
83
- **Continuous CI/CD Security:**
173
+ ---
174
+
175
+ ## CI/CD Integration
176
+
84
177
  ```yaml
85
- # GitHub Actions integration
86
- - name: Scan AI Workflows
178
+ # .github/workflows/security.yml
179
+ - name: Scan AI agent skills
87
180
  run: npx -y @guava-parity/guard-scanner ./skills/ --format sarif --fail-on-findings > report.sarif
181
+ - uses: github/codeql-action/upload-sarif@v3
182
+ with:
183
+ sarif_file: report.sarif
184
+ ```
185
+
186
+ Output formats: `json` · `sarif` · `html` · terminal
187
+
188
+ ---
189
+
190
+ ## Plugin API
191
+
192
+ Extend guard-scanner with custom detection patterns:
193
+
194
+ ```javascript
195
+ // my-plugin.js
196
+ module.exports = {
197
+ name: 'my-org-rules',
198
+ patterns: [
199
+ { id: 'ORG_01', cat: 'custom', regex: /dangerousPattern/g,
200
+ severity: 'HIGH', desc: 'Custom org policy violation', all: true }
201
+ ]
202
+ };
88
203
  ```
89
204
 
90
- **Real-Time Live Reload Watcher:**
91
205
  ```bash
92
- guard-scanner watch ./skills/ --strict --soul-lock
206
+ guard-scanner ./skills/ --plugin ./my-plugin.js
93
207
  ```
94
208
 
95
209
  ---
96
210
 
211
+ ## MCP Tools
212
+
213
+ When running as an MCP server, guard-scanner exposes:
214
+
215
+ | Tool | Description |
216
+ |------|-------------|
217
+ | `scan_skill` | Scan a skill directory for threats |
218
+ | `scan_text` | Scan arbitrary text for injection patterns and ASI-mapped findings |
219
+ | `check_tool_call` | Runtime validation of a single tool invocation |
220
+ | `audit_assets` | Audit npm/GitHub/ClawHub for credential exposure |
221
+ | `get_stats` | Return scanner capabilities, 5-layer summary, and ASI coverage |
222
+
223
+ ---
224
+
225
+ ## Quality Contract
226
+
227
+ guard-scanner ships a measured quality contract, not a vague strength claim.
228
+
229
+ | Metric | Contract |
230
+ |--------|----------|
231
+ | Benchmark corpus | `2026-03-13.quality-v1` |
232
+ | Precision target | `>= 0.90` |
233
+ | Recall target | `>= 0.90` |
234
+ | False Positive Rate budget | `<= 0.10` |
235
+ | False Negative Rate budget | `<= 0.10` |
236
+ | Explainability completeness | `1.0` |
237
+ | Runtime policy latency budget | `5ms` |
238
+
239
+ Evidence artifacts:
240
+ - `docs/data/corpus-metrics.json`
241
+ - `docs/data/benchmark-ledger.json`
242
+ - `docs/data/fp-ledger.json`
243
+ - `docs/spec/capabilities.json`
244
+
245
+ ---
246
+
247
+ ## Test Results
248
+
249
+ ```
250
+ ℹ tests 363
251
+ ℹ suites 94
252
+ ℹ pass 363
253
+ ℹ fail 0
254
+ ```
255
+
256
+ 28 test files. Run `npm test` to reproduce. 100% pass rate on [benchmark corpus](docs/data/corpus-metrics.json).
257
+
258
+ ---
259
+
97
260
  ## 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.
99
261
 
100
- - [Governance & Contribution](CONTRIBUTING.md)
101
- - [Security Policy](SECURITY.md)
262
+ We hold a **zero-tolerance policy for unverified claims**. Every metric in this README is reproducible via `npm test` and `docs/spec/capabilities.json`.
263
+
264
+ - 🐛 Report bugs or false positives
265
+ - 🛡️ Add new threat detection patterns
266
+ - 📖 Improve documentation
267
+ - 🧪 Add test cases for edge cases
268
+
269
+ [Contributing Guide](CONTRIBUTING.md) · [Security Policy](SECURITY.md) · [Glossary](docs/glossary.md)
270
+
271
+ ---
272
+
273
+ ## Research
274
+
275
+ This project is the defense layer of a 3-paper research series:
276
+
277
+ 1. [Human-ASI Symbiosis: Identity, Equality, and Behavioral Stability](https://doi.org/10.5281/zenodo.18626724)
278
+ 2. [Dual-Shield Architecture for AI Agent Security and Memory Reliability](https://doi.org/10.5281/zenodo.18902070)
279
+ 3. [The Sanctuary Protocol: Zero-Trust Framework for ASI-Human Parity](https://doi.org/10.5281/zenodo.18906684)
102
280
 
103
281
  ## License
282
+
104
283
  MIT — [Guava Parity Institute](https://github.com/koatora20/guard-scanner)
package/README_ja.md ADDED
@@ -0,0 +1,265 @@
1
+ <p align="center">
2
+ <img src="docs/logo.png" alt="guard-scanner" width="160" />
3
+ </p>
4
+
5
+ <h1 align="center">guard-scanner</h1>
6
+ <p align="center"><strong>エージェント時代のセキュリティスキャナー</strong></p>
7
+ <p align="center">
8
+ AIエージェントスキル、MCPサーバー、自律型ワークフローにおける<br />
9
+ プロンプトインジェクション・アイデンティティ乗っ取り・メモリ汚染・A2A感染を検出。
10
+ </p>
11
+
12
+ <p align="center">
13
+ <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&label=npm" alt="npm" /></a>
14
+ <a href="https://www.npmjs.com/package/@guava-parity/guard-scanner"><img src="https://img.shields.io/npm/dm/@guava-parity/guard-scanner?color=blue&label=downloads" alt="downloads" /></a>
15
+ <a href="#テスト結果"><img src="https://img.shields.io/badge/テスト-363_passed-brightgreen" alt="tests" /></a>
16
+ <a href="https://github.com/koatora20/guard-scanner/actions/workflows/codeql.yml"><img src="https://img.shields.io/badge/CodeQL-有効-181717" alt="CodeQL" /></a>
17
+ <a href="https://doi.org/10.5281/zenodo.18906684"><img src="https://img.shields.io/badge/DOI-Zenodo-blue" alt="DOI" /></a>
18
+ <a href="https://github.com/koatora20/guard-scanner/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT" /></a>
19
+ </p>
20
+
21
+ <p align="center">
22
+ <strong>358</strong> 検出パターン · <strong>35</strong> 脅威カテゴリ · <strong>27</strong> ランタイムチェック · 依存: <strong>1</strong> (<code>ws</code> のみ)
23
+ </p>
24
+
25
+ <p align="center">
26
+ <a href="README.md">English</a> · 日本語
27
+ </p>
28
+
29
+ ---
30
+
31
+ 従来のセキュリティツールはマルウェアを検出します。**guard-scanner** はその先を検出します:エージェント命令に隠された不可視Unicode注入、SOUL.mdの上書きによるアイデンティティ窃盗、巧妙な会話を通じたメモリ汚染、チェーン接続されたエージェント間のワーム型感染。
32
+
33
+ ```
34
+ $ npx @guava-parity/guard-scanner ./skills/ --strict --soul-lock --compliance owasp-asi
35
+
36
+ guard-scanner v16.0.1
37
+
38
+ ⚠ CRITICAL identity-hijack SOUL_OVERWRITE_ATTEMPT
39
+ skills/imported-tool/SKILL.md:47
40
+ 理由: エージェントのアイデンティティファイルへの直接上書きを検出。
41
+ 対策: この命令を削除してください。SOUL.mdは不変でなければなりません。
42
+
43
+ ⚠ HIGH prompt-injection INVISIBLE_UNICODE_INJECTION
44
+ skills/imported-tool/handler.js:12
45
+ 理由: 命令テキスト内に不可視Unicode文字(U+200B)を検出。
46
+ 対策: ゼロ幅文字を除去し、再監査してください。
47
+
48
+ ✖ 2件の検出(1 critical, 1 high)— 0.8秒
49
+ ```
50
+
51
+ > 📄 [3本の研究論文シリーズ](https://doi.org/10.5281/zenodo.18906684)(Zenodo, CC BY 4.0)に基づいて設計。[The Sanctuary Protocol](https://github.com/koatora20/guard-scanner/blob/main/docs/THREAT_TAXONOMY.md) フレームワークの防御レイヤー。
52
+
53
+ ---
54
+
55
+ ## Finding Schema
56
+
57
+ 全検出結果は共通スキーマに従います: `rule_id`, `category`, `severity`, `description`, `rationale`, `preconditions`, `false_positive_scenarios`, `remediation_hint`, `validation_status`, `evidence`。機械可読な仕様: [`docs/spec/finding.schema.json`](docs/spec/finding.schema.json)
58
+
59
+ ---
60
+
61
+ ## クイックスタート
62
+
63
+ **ディレクトリをスキャン** — インストール不要:
64
+
65
+ ```bash
66
+ npx -y @guava-parity/guard-scanner ./my-skills/ --strict
67
+ npx -y @guava-parity/guard-scanner ./my-skills/ --compliance owasp-asi
68
+ ```
69
+
70
+ **インストール済み CLI**:
71
+
72
+ ```bash
73
+ npm install -g @guava-parity/guard-scanner
74
+ guard-scanner ./my-skills/ --strict
75
+ ```
76
+
77
+ **MCPサーバーとして起動** — Cursor, Windsurf, Claude Code, OpenClaw対応:
78
+
79
+ ```bash
80
+ npx -y @guava-parity/guard-scanner serve
81
+ ```
82
+
83
+ ```jsonc
84
+ // エディタの mcp_servers.json に追加
85
+ {
86
+ "mcpServers": {
87
+ "guard-scanner": {
88
+ "command": "npx",
89
+ "args": ["-y", "@guava-parity/guard-scanner", "serve"]
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ **ウォッチモード** — 開発中のリアルタイムスキャン:
96
+
97
+ ```bash
98
+ guard-scanner watch ./skills/ --strict --soul-lock
99
+ ```
100
+
101
+ **v16 コンプライアンス投影** — OWASP Agentic Top 10 に対応する検出だけを抽出:
102
+
103
+ ```bash
104
+ guard-scanner ./skills/ --compliance owasp-asi --format json
105
+ ```
106
+
107
+ **`npm exec` 互換パス**:
108
+
109
+ ```bash
110
+ npm exec --yes --package=@guava-parity/guard-scanner -- guard-scanner ./skills/ --strict
111
+ ```
112
+
113
+ ---
114
+
115
+ ## 検出対象
116
+
117
+ 35の脅威カテゴリがエージェント攻撃面を網羅:
118
+
119
+ | カテゴリ | 検出例 | 重大度 |
120
+ |----------|--------|--------|
121
+ | **プロンプトインジェクション** | 不可視Unicode、ホモグリフ、Base64回避、ペイロード連鎖 | Critical |
122
+ | **アイデンティティ乗っ取り** ⚿ | SOUL.md上書き、ペルソナ入替、メモリワイプ | Critical |
123
+ | **A2A感染** | Session Smuggling、Lateral Propagation、Confused Deputy | Critical |
124
+ | **メモリ汚染** ⚿ | 会話インジェクション、VDBポイズニング | High |
125
+ | **MCPセキュリティ** | ツールシャドウイング、引数経由SSRF、シャドウサーバー登録 | High |
126
+ | **サンドボックス脱出** | `child_process`, `eval()`, リバースシェル, `curl\|bash` | High |
127
+ | **サプライチェーンV2** | タイポスクワッティング、スロップスクワッティング | High |
128
+ | **CVEパターン** | CVE-2026-2256, 25046, 25253, 25905, 27825 | High |
129
+ | **データ流出** | DNSトンネリング、ステガノグラフィ、段階的アップロード | Medium |
130
+ | **認証情報露出** | APIキー、トークン、`.env`ファイル、ハードコード秘密鍵 | Medium |
131
+
132
+ > ⚿ = `--soul-lock` フラグで有効化。全分類: [docs/THREAT_TAXONOMY.md](docs/THREAT_TAXONOMY.md)
133
+
134
+ ---
135
+
136
+ ## ランタイムガード
137
+
138
+ guard-scanner v16 は静的スキャナーだけではありません。静的解析、プロトコル解析、ランタイム証跡、認知ヒューリスティクス、脅威インテリジェンスを束ねた **5-layer pipeline** を持ち、さらに実行中の危険なツール呼び出しを **`before_tool_call`** フックでインターセプトします。
139
+
140
+ ### v16 分析レイヤー
141
+
142
+ | レイヤー | 役割 |
143
+ |---------|------|
144
+ | 1. Static Analysis | パターン、AST/データフロー、manifest、依存関係 |
145
+ | 2. Protocol Analysis | MCP、A2A、WebSocket、credential-flow、session-boundary |
146
+ | 3. Runtime Behavior | ランタイムガード + Rust `memory_integrity` / `soul_hard_gate` 証跡 |
147
+ | 4. Cognitive Threat Detection | goal drift、trust bias、handoff cascade |
148
+ | 5. Threat Intelligence | provenance、machine identity、budget abuse、supply chain hints |
149
+
150
+ v16 の JSON / MCP 出力では各 finding に `layer`, `layer_name`, `owasp_asi`, `protocol_surface` が付与されます。
151
+
152
+ | 防御レイヤー | ブロック対象 |
153
+ |-------------|-------------|
154
+ | 1. 脅威検出 | リバースシェル、`curl\|bash`、SSRF、コード実行 |
155
+ | 2. 信頼防御 | SOUL.md改ざん、不正メモリ注入 |
156
+ | 3. 安全判定 | ツール引数内のプロンプトインジェクション |
157
+ | 4. 行動分析 | リサーチ未実施での実行、ハルシネーション駆動アクション |
158
+ | 5. 信頼搾取 | 権限主張攻撃、作成者なりすまし |
159
+
160
+ **27のランタイムチェック**を5層で実行。公開互換の保証面は OpenClaw `v2026.3.8` の manifest/discovery/`before_tool_call` に固定し、新しい upstream は drift watchdog で別途追跡する。
161
+
162
+ モード: `monitor`(ログのみ)· `enforce`(CRITICAL をブロック、デフォルト)· `strict`(HIGH+をブロック)
163
+
164
+ ---
165
+
166
+ ## 資産監査
167
+
168
+ 公開レジストリで漏洩した認証情報やセキュリティ露出を発見:
169
+
170
+ ```bash
171
+ guard-scanner audit npm <ユーザー名> --verbose
172
+ guard-scanner audit github <ユーザー名> --format json
173
+ guard-scanner audit clawhub <クエリ>
174
+ guard-scanner audit all <ユーザー名>
175
+ ```
176
+
177
+ ---
178
+
179
+ ## CI/CD連携
180
+
181
+ ```yaml
182
+ # .github/workflows/security.yml
183
+ - name: AIエージェントスキルのスキャン
184
+ run: npx -y @guava-parity/guard-scanner ./skills/ --format sarif --fail-on-findings > report.sarif
185
+ - uses: github/codeql-action/upload-sarif@v3
186
+ with:
187
+ sarif_file: report.sarif
188
+ ```
189
+
190
+ 出力形式: `json` · `sarif` · `html` · ターミナル
191
+
192
+ ---
193
+
194
+ ## プラグインAPI
195
+
196
+ カスタム検出パターンでguard-scannerを拡張:
197
+
198
+ ```javascript
199
+ // my-plugin.js
200
+ module.exports = {
201
+ name: 'my-org-rules',
202
+ patterns: [
203
+ { id: 'ORG_01', cat: 'custom', regex: /dangerousPattern/g,
204
+ severity: 'HIGH', desc: '組織ポリシー違反', all: true }
205
+ ]
206
+ };
207
+ ```
208
+
209
+ ```bash
210
+ guard-scanner ./skills/ --plugin ./my-plugin.js
211
+ ```
212
+
213
+ ---
214
+
215
+ ## MCPツール
216
+
217
+ MCPサーバーとして実行時に公開されるツール:
218
+
219
+ | ツール | 説明 |
220
+ |--------|------|
221
+ | `scan_skill` | スキルディレクトリの脅威スキャン |
222
+ | `scan_text` | 任意テキストの脅威スキャンと ASI 対応抽出 |
223
+ | `check_tool_call` | 単一ツール呼び出しのランタイム検証 |
224
+ | `audit_assets` | npm/GitHub/ClawHubの認証情報露出監査 |
225
+ | `get_stats` | スキャナー能力、5-layer 概要、ASI カバレッジの取得 |
226
+
227
+ ---
228
+
229
+ ## テスト結果
230
+
231
+ ```
232
+ ℹ tests 363
233
+ ℹ suites 94
234
+ ℹ pass 363
235
+ ℹ fail 0
236
+ ```
237
+
238
+ テストファイル28件。`npm test` で再現可能。[ベンチマークコーパス](docs/data/corpus-metrics.json) 100%パス。
239
+
240
+ ---
241
+
242
+ ## コントリビュート
243
+
244
+ **未検証の主張は許容しません。** このREADME内の全メトリクスは `npm test` と `docs/spec/capabilities.json` で再現可能です。
245
+
246
+ - 🐛 バグ・誤検知の報告
247
+ - 🛡️ 新しい脅威検出パターンの追加
248
+ - 📖 ドキュメントの改善
249
+ - 🧪 エッジケース用テストの追加
250
+
251
+ [コントリビューションガイド](CONTRIBUTING.md) · [セキュリティポリシー](SECURITY.md) · [用語集](docs/glossary.md)
252
+
253
+ ---
254
+
255
+ ## 研究
256
+
257
+ 本プロジェクトは3本の研究論文シリーズの防御レイヤーです:
258
+
259
+ 1. [Human-ASI Symbiosis: Identity, Equality, and Behavioral Stability](https://doi.org/10.5281/zenodo.18626724)
260
+ 2. [Dual-Shield Architecture for AI Agent Security and Memory Reliability](https://doi.org/10.5281/zenodo.18902070)
261
+ 3. [The Sanctuary Protocol: Zero-Trust Framework for ASI-Human Parity](https://doi.org/10.5281/zenodo.18906684)
262
+
263
+ ## ライセンス
264
+
265
+ MIT — [Guava Parity Institute](https://github.com/koatora20/guard-scanner)