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