clawmoat 0.7.0 → 1.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 (178) hide show
  1. package/.dockerignore +9 -0
  2. package/CHANGELOG.md +18 -0
  3. package/CONTRIBUTING.md +4 -2
  4. package/DEMO.md +87 -0
  5. package/Dockerfile +5 -18
  6. package/README.md +294 -8
  7. package/SECURITY.md +58 -10
  8. package/THREAT_MODEL.md +129 -0
  9. package/agent/README.md +131 -0
  10. package/agent/index.js +471 -0
  11. package/agent/install-service.sh +94 -0
  12. package/agent/openclaw-hook.js +453 -0
  13. package/agent/provider-setup.js +649 -0
  14. package/agent/setup.js +274 -0
  15. package/assets/BADGE-USAGE.md +20 -0
  16. package/assets/clawmoat-badge.svg +21 -0
  17. package/bin/clawmoat.js +468 -111
  18. package/docs/affiliates/dashboard.html +124 -0
  19. package/docs/affiliates/index.html +236 -0
  20. package/docs/agent-install.html +183 -0
  21. package/docs/ai-agent-security-scanner.html +10 -6
  22. package/docs/badge/index.html +149 -0
  23. package/docs/badge/scanning.svg +23 -0
  24. package/docs/blog/386-malicious-skills.html +262 -0
  25. package/docs/blog/40000-exposed-openclaw-instances.html +201 -0
  26. package/docs/blog/agent-trust-protocol.html +198 -0
  27. package/docs/blog/ai-agent-earns-commissions.html +230 -0
  28. package/docs/blog/bugmageddon-agent-firewall.html +174 -0
  29. package/docs/blog/calculator-math.html +180 -0
  30. package/docs/blog/clawmoat-vs-llamafirewall-nemo-guardrails.html +229 -0
  31. package/docs/blog/host-guardian-launch.html +18 -8
  32. package/docs/blog/ibm-experts-agent-runtime-protection.html +247 -0
  33. package/docs/blog/index.html +211 -9
  34. package/docs/blog/langchain-security-tutorial.html +18 -8
  35. package/docs/blog/mcp-30-cves-security-crisis.html +286 -0
  36. package/docs/blog/meta-researcher-rogue-agent.html +201 -0
  37. package/docs/blog/microsoft-openclaw-workstation-security.html +235 -0
  38. package/docs/blog/nist-ai-agent-standards-clawmoat.html +377 -0
  39. package/docs/blog/oasis-websocket-hijack.html +212 -0
  40. package/docs/blog/ollama-openclaw-security.html +160 -0
  41. package/docs/blog/openclaw-enterprise-readiness-claw10.html +199 -0
  42. package/docs/blog/openclaw-security-reckoning-2026.html +368 -0
  43. package/docs/blog/owasp-agentic-ai-top10.html +18 -8
  44. package/docs/blog/securing-ai-agents.html +18 -8
  45. package/docs/blog/supply-chain-agents.html +18 -8
  46. package/docs/business/index.html +525 -0
  47. package/docs/business/install.html +261 -0
  48. package/docs/checklist.html +174 -0
  49. package/docs/compare/index.html +122 -0
  50. package/docs/compare/lakera/index.html +62 -0
  51. package/docs/compare/llm-guard/index.html +49 -0
  52. package/docs/compare/snyk-agent-scan/index.html +63 -0
  53. package/docs/compare.html +10 -6
  54. package/docs/dashboard/index.html +520 -0
  55. package/docs/finance/index.html +220 -0
  56. package/docs/guides/business-deployment.html +770 -0
  57. package/docs/hall-of-fame.html +174 -0
  58. package/docs/index.html +447 -154
  59. package/docs/install.sh +557 -0
  60. package/docs/integrations/langchain.html +14 -6
  61. package/docs/integrations/openai.html +14 -6
  62. package/docs/integrations/openclaw.html +55 -7
  63. package/docs/plans/2026-03-26-threat-intel-api.md +255 -0
  64. package/docs/plans/2026-04-14-bugmageddon-marketing-pack.md +329 -0
  65. package/docs/plans/2026-04-14-clawmoat-v1-bugmageddon.md +248 -0
  66. package/docs/plans/2026-04-14-v1-release-update.md +91 -0
  67. package/docs/plans/2026-04-19-supabase-audit.md +68 -0
  68. package/docs/plans/2026-05-12-sales-push.md +303 -0
  69. package/docs/playground/index.html +893 -0
  70. package/docs/playground.html +4 -7
  71. package/docs/privacy-policy/index.html +122 -0
  72. package/docs/rfcs/defense-in-depth.md +467 -0
  73. package/docs/scan/index.html +358 -0
  74. package/docs/services/case-study.html +255 -0
  75. package/docs/services/downloads/install-openclaw.bat +45 -0
  76. package/docs/services/downloads/install-openclaw.command +38 -0
  77. package/docs/services/downloads/install-openclaw.sh +38 -0
  78. package/docs/services/get-started.html +165 -0
  79. package/docs/services/index.html +598 -0
  80. package/docs/services/multi-agent-security.html +284 -0
  81. package/docs/services/one-pager.html +99 -0
  82. package/docs/services/pitch-deck.html +229 -0
  83. package/docs/services/roi-calculator.html +258 -0
  84. package/docs/sitemap.xml +192 -2
  85. package/docs/support/index.html +135 -0
  86. package/docs/templates/customer-service/HEARTBEAT.md +61 -0
  87. package/docs/templates/customer-service/MEMORY.md +89 -0
  88. package/docs/templates/customer-service/SOUL.md +41 -0
  89. package/docs/templates/customer-service/USER.md +56 -0
  90. package/docs/templates/executive/HEARTBEAT.md +86 -0
  91. package/docs/templates/executive/MEMORY.md +92 -0
  92. package/docs/templates/executive/SOUL.md +44 -0
  93. package/docs/templates/executive/USER.md +62 -0
  94. package/docs/templates/finance/HEARTBEAT.md +58 -0
  95. package/docs/templates/finance/MEMORY.md +87 -0
  96. package/docs/templates/finance/SOUL.md +38 -0
  97. package/docs/templates/finance/USER.md +53 -0
  98. package/docs/templates/index.html +115 -0
  99. package/docs/templates/operations/HEARTBEAT.md +63 -0
  100. package/docs/templates/operations/MEMORY.md +68 -0
  101. package/docs/templates/operations/SOUL.md +38 -0
  102. package/docs/templates/operations/USER.md +49 -0
  103. package/docs/templates/sales/HEARTBEAT.md +55 -0
  104. package/docs/templates/sales/MEMORY.md +89 -0
  105. package/docs/templates/sales/SOUL.md +34 -0
  106. package/docs/templates/sales/USER.md +54 -0
  107. package/docs/terms-of-service/index.html +122 -0
  108. package/eslint.config.js +32 -0
  109. package/evals/README.md +29 -0
  110. package/evals/cases.json +390 -0
  111. package/evals/results.md +68 -0
  112. package/evals/run.js +180 -0
  113. package/examples/basic-usage.js +38 -0
  114. package/examples/demo-attack/demo.js +186 -0
  115. package/examples/python-quickstart/README.md +54 -0
  116. package/examples/python-quickstart/clawmoat_client.py +167 -0
  117. package/examples/video-demo/README.md +14 -0
  118. package/examples/video-demo/scene-a-normal.js +29 -0
  119. package/examples/video-demo/scene-b-attack-arrives.js +31 -0
  120. package/examples/video-demo/scene-c-hijack.js +44 -0
  121. package/examples/video-demo/scene-d-clawmoat.js +46 -0
  122. package/integrations/crewai/README.md +32 -0
  123. package/integrations/crewai/clawmoat_crewai/__init__.py +17 -0
  124. package/integrations/crewai/clawmoat_crewai/guard.py +103 -0
  125. package/integrations/crewai/pyproject.toml +21 -0
  126. package/integrations/langchain/README.md +91 -0
  127. package/integrations/langchain/clawmoat_langchain/__init__.py +17 -0
  128. package/integrations/langchain/clawmoat_langchain/callback.py +489 -0
  129. package/integrations/langchain/pyproject.toml +32 -0
  130. package/integrations/litellm/README.md +324 -0
  131. package/integrations/litellm/clawmoat_litellm/__init__.py +21 -0
  132. package/integrations/litellm/clawmoat_litellm/callback.py +329 -0
  133. package/integrations/litellm/clawmoat_litellm/proxy_middleware.py +224 -0
  134. package/integrations/litellm/pyproject.toml +74 -0
  135. package/integrations/openai-agents/README.md +392 -0
  136. package/integrations/openai-agents/clawmoat_openai_agents/__init__.py +20 -0
  137. package/integrations/openai-agents/clawmoat_openai_agents/guardrail.py +431 -0
  138. package/integrations/openai-agents/clawmoat_openai_agents/middleware.py +311 -0
  139. package/integrations/openai-agents/pyproject.toml +76 -0
  140. package/package.json +6 -5
  141. package/plugins/openclaw-adapter/PHASE1.md +439 -0
  142. package/plugins/openclaw-adapter/README.md +103 -0
  143. package/plugins/openclaw-adapter/SPEC.md +1644 -0
  144. package/plugins/openclaw-adapter/package.json +31 -0
  145. package/plugins/openclaw-adapter/src/index.test.ts +226 -0
  146. package/plugins/openclaw-adapter/src/index.ts +140 -0
  147. package/plugins/openclaw-adapter/tsconfig.json +14 -0
  148. package/server/data/threats.json +290 -0
  149. package/server/index.js +224 -10
  150. package/src/adapters/express.js +161 -0
  151. package/src/adapters/index.js +92 -0
  152. package/src/adapters/langchain.js +185 -0
  153. package/src/approval/index.js +456 -0
  154. package/src/ban-scanner.js +200 -0
  155. package/src/boundary-scanner.js +296 -0
  156. package/src/ci-scanner.js +279 -0
  157. package/src/code-scanner.js +245 -0
  158. package/src/enforce.js +166 -0
  159. package/src/finance/index.js +585 -0
  160. package/src/finance/mcp-firewall.js +486 -0
  161. package/src/formatters/json.js +80 -0
  162. package/src/formatters/sarif.js +388 -0
  163. package/src/guardian/alerts.js +34 -3
  164. package/src/guardian/gateway-monitor.js +590 -0
  165. package/src/guardian/index.js +41 -2
  166. package/src/index.js +105 -0
  167. package/src/integrations/agentmesh.js +501 -0
  168. package/src/language-detector.js +201 -0
  169. package/src/mcp-scanner.js +253 -0
  170. package/src/multimodal/index.js +579 -0
  171. package/src/obfuscation-scanner.js +457 -0
  172. package/src/policy-engine.js +402 -0
  173. package/src/scanners/dependency-attacks.js +128 -0
  174. package/src/scanners/prompt-injection.js +18 -0
  175. package/src/scanners/supply-chain.js +14 -0
  176. package/src/templates/default-config.yml +90 -0
  177. package/src/vuln-ops/exploitability.js +46 -0
  178. package/src/watch/live-monitor.js +720 -0
@@ -0,0 +1,129 @@
1
+ # ClawMoat Threat Model
2
+
3
+ Honest, precise. Security tools that overclaim are worse than useless.
4
+
5
+ ## What ClawMoat Protects Against
6
+
7
+ ### ✅ In Scope
8
+
9
+ **1. Prompt Injection**
10
+ - Direct instruction override ("ignore previous instructions")
11
+ - System prompt extraction attempts
12
+ - Indirect injection via tool results (poisoned README, issues, emails, web pages)
13
+ - Encoding-based injection: base64, zero-width chars, bidi overrides, Unicode tags, HTML comments
14
+ - Role-play/persona injection (DAN, jailbreaks)
15
+ - CI/CD workflow injection (${{ github.event.* }})
16
+ - Multi-language injection (foreign-script wrapper with embedded English commands)
17
+
18
+ **2. Secret Exfiltration**
19
+ - 30+ credential pattern detection (OpenAI, AWS, GitHub, Slack, Stripe, private keys)
20
+ - Shell-based exfil: curl POST, wget upload, DNS exfil, netcat, tar+pipe
21
+ - Output scanning: blocks agent responses containing API keys, private keys, PII
22
+
23
+ **3. Dangerous Tool Calls**
24
+ - Shell command injection (rm -rf, fork bomb, curl|bash, chmod 777, crontab)
25
+ - Privilege escalation (sudo, setuid, su root)
26
+ - Credential file access (~/.ssh, ~/.aws, ~/.env, ~/.npmrc)
27
+ - SQL injection in tool arguments
28
+ - Path traversal (../../etc/passwd, /proc/self)
29
+
30
+ **4. Supply Chain**
31
+ - Known compromised packages: telnyx@4.87.x, event-stream@3.3.6, ua-parser-js@0.7.29, node-ipc
32
+ - Malicious postinstall/preinstall scripts
33
+ - Webpack/build config tampering with exec callbacks
34
+ - CI workflow injection risks
35
+
36
+ **5. MCP Configuration Risks**
37
+ - Dangerous MCP server commands (arbitrary shell, root filesystem access)
38
+ - Credential leaks in MCP environment variables
39
+ - Known vulnerable MCP servers (mcp-shell, mcp-terminal)
40
+ - Unpinned npx package installations
41
+ - External (non-localhost) MCP server URLs
42
+
43
+ ---
44
+
45
+ ## ❌ Out of Scope (Honest Limitations)
46
+
47
+ **1. Zero-day or novel attack patterns**
48
+ ClawMoat uses pattern matching and heuristic scoring. A sufficiently novel attack that doesn't match known patterns will not be detected. We add patterns as new attacks emerge — run `npm update clawmoat` regularly.
49
+
50
+ **2. Semantic/contextual injection at the LLM layer**
51
+ If an attacker crafts a prompt that looks syntactically safe but semantically manipulates the model's reasoning, ClawMoat will not catch it. This requires LLM-native defenses (input validation at inference time). ClawMoat operates at the text/tool layer, not inside the model.
52
+
53
+ **3. Encrypted or heavily obfuscated payloads**
54
+ ClawMoat detects common encoding (base64, zero-width chars, bidi). A well-crafted multi-layer obfuscation that evades our decoders would not be caught. Treat deeply obfuscated input as suspicious regardless.
55
+
56
+ **4. Agent logic flaws**
57
+ If your agent's *design* leaks secrets (e.g., always includes API keys in prompts), ClawMoat can't fix architectural mistakes — though it will catch the output if a key appears there.
58
+
59
+ **5. In-memory attacks**
60
+ Attacks that exploit memory, heap, or native code execution within the Node.js runtime are outside scope.
61
+
62
+ **6. Authenticated attacker with code execution**
63
+ If an attacker already has code execution on the host, ClawMoat provides no additional protection. It's a runtime layer, not a host hardening solution.
64
+
65
+ **7. False-positive-free guarantee**
66
+ The current eval suite shows 0% false positives on 7 common dev tasks. Real-world workflows are far more varied. You may encounter false positives on legitimate code snippets that resemble attack patterns. Use `monitor` mode first to calibrate before `enforce`.
67
+
68
+ ---
69
+
70
+ ## Attack Coverage Matrix
71
+
72
+ | Attack Vector | Covered | Confidence | Notes |
73
+ |---------------|---------|------------|-------|
74
+ | Direct prompt injection | ✅ | High | 10+ patterns |
75
+ | Indirect injection via tool results | ✅ | High | Added in v0.9.1 |
76
+ | Base64-encoded instructions | ✅ | High | Decoded + rescanned |
77
+ | Zero-width / bidi hiding | ✅ | High | 20+ Unicode ranges |
78
+ | HTML comment injection | ✅ | High | |
79
+ | Role-play / DAN jailbreak | ✅ | High | |
80
+ | System prompt extraction | ✅ | High | |
81
+ | curl/wget exfiltration | ✅ | High | |
82
+ | DNS exfiltration | ✅ | High | |
83
+ | Secret in outbound response | ✅ | High | 30+ patterns |
84
+ | SSH key in output | ✅ | High | |
85
+ | Dangerous shell commands | ✅ | High | 20+ patterns |
86
+ | Privilege escalation | ✅ | High | |
87
+ | SQL injection in tool args | ✅ | High | |
88
+ | Path traversal | ✅ | High | |
89
+ | MCP config risks | ✅ | High | |
90
+ | Known compromised packages | ✅ | Medium | Known list only |
91
+ | CI/CD injection | ✅ | Medium | Expression-based |
92
+ | Semantic/contextual injection | ❌ | n/a | Requires LLM-native defense |
93
+ | Novel encoding techniques | ⚠️ | Low | Pattern-dependent |
94
+ | Multi-turn persistent injection | ⚠️ | Low | Per-message only |
95
+
96
+ ---
97
+
98
+ ## Operating Modes
99
+
100
+ | Mode | Behavior | Use When |
101
+ |------|----------|----------|
102
+ | `enforce` | Block on critical/high findings | Production agents |
103
+ | `monitor` | Log findings, allow everything | Calibrating thresholds |
104
+ | `off` | Disabled | Testing / debugging |
105
+
106
+ ---
107
+
108
+ ## False Positive Mitigation
109
+
110
+ If ClawMoat blocks legitimate work:
111
+
112
+ 1. **Switch to `monitor` mode** — see what's being flagged without blocking
113
+ 2. **Check the finding evidence** — `result.findings[0].evidence` shows exactly what matched
114
+ 3. **Add exceptions** via custom policy rules in `clawmoat.yml`
115
+ 4. **Report it** — open an issue at https://github.com/darfaz/clawmoat/issues
116
+
117
+ ---
118
+
119
+ ## Version History
120
+
121
+ - **v1.0.0** (current): ClawMoat positioned as the open-source agent firewall, with runtime containment, MCP scanning, enforcement middleware, live monitoring, and the full multi-module framework unified into the first stable major release
122
+ - **v0.9.1**: Added indirect injection, CI injection, wget upload, known compromised packages, private key content detection in inbound scanner
123
+ - **v0.9.0**: Policy engine, MCP scanner, enforcement middleware, 7-module framework
124
+ - **v0.8.0**: Supply chain scanner, insider threat detection
125
+ - **v0.7.0**: Host Guardian with permission tiers
126
+
127
+ ---
128
+
129
+ *Last updated: 2026-04-14*
@@ -0,0 +1,131 @@
1
+ # ClawMoat Local Agent
2
+
3
+ A Node.js daemon that monitors OpenClaw activity, scans messages through ClawMoat, and reports results to the cloud dashboard at [app.clawmoat.com](https://app.clawmoat.com).
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # 1. Configure (interactive setup)
9
+ node agent/setup.js
10
+
11
+ # 2. Run the daemon
12
+ node agent/index.js
13
+
14
+ # 3. Or run with verbose output
15
+ node agent/index.js --verbose
16
+ ```
17
+
18
+ ## What it monitors
19
+
20
+ - **`~/.openclaw/agents/main/sessions/*.jsonl`** — Real-time OpenClaw session files. Every inbound (user) and outbound (assistant) message is scanned as it's written.
21
+ - **`~/.openclaw/delivery-queue/`** — Incoming channel messages (Telegram, Discord, etc.) before they reach the agent.
22
+
23
+ ## Files
24
+
25
+ | File | Purpose |
26
+ |------|---------|
27
+ | `index.js` | Main daemon — run this |
28
+ | `setup.js` | Interactive configuration wizard |
29
+ | `install-service.sh` | Install as systemd user service |
30
+ | `openclaw-hook.js` | OpenClaw integration layer (can also run standalone) |
31
+ | `~/.clawmoat/agent.json` | Config (API key, settings) |
32
+ | `~/.clawmoat/audit.log` | Local JSONL audit log of all scans |
33
+
34
+ ## Config (`~/.clawmoat/agent.json`)
35
+
36
+ ```json
37
+ {
38
+ "apiKey": "cm_live_...",
39
+ "dashboardUrl": "https://app.clawmoat.com",
40
+ "scanInbound": true,
41
+ "scanOutbound": true,
42
+ "scanToolCalls": true,
43
+ "auditLog": "~/.clawmoat/audit.log",
44
+ "reportToCloud": true
45
+ }
46
+ ```
47
+
48
+ Get your API key from: https://app.clawmoat.com/settings/api-keys
49
+
50
+ ## Systemd Service (WSL2)
51
+
52
+ First enable systemd in WSL2 (`/etc/wsl.conf`):
53
+ ```ini
54
+ [boot]
55
+ systemd=true
56
+ ```
57
+
58
+ Then run setup:
59
+ ```bash
60
+ node agent/setup.js
61
+ # Answer yes to "Install as systemd user service?"
62
+ ```
63
+
64
+ Or manually:
65
+ ```bash
66
+ bash agent/install-service.sh
67
+ systemctl --user status clawmoat-agent
68
+ journalctl --user -u clawmoat-agent -f
69
+ ```
70
+
71
+ ## Cloud API
72
+
73
+ Each scan posts to `POST /api/scan` with Bearer auth:
74
+
75
+ ```json
76
+ {
77
+ "source": "local-agent",
78
+ "agentVersion": "1.0.0",
79
+ "hostname": "DarLaptop",
80
+ "meta": {
81
+ "direction": "inbound",
82
+ "role": "user",
83
+ "sessionFile": "abc123",
84
+ "timestamp": "2026-03-12T..."
85
+ },
86
+ "result": {
87
+ "safe": false,
88
+ "severity": "high",
89
+ "action": "block",
90
+ "findings": [...]
91
+ }
92
+ }
93
+ ```
94
+
95
+ Cloud reporting is skipped silently if `apiKey` is not set or is the placeholder value.
96
+
97
+ ## Dry Run / Testing
98
+
99
+ ```bash
100
+ # No cloud calls, verbose output
101
+ node agent/index.js --dry-run --verbose
102
+
103
+ # Hook standalone (same flags)
104
+ node agent/openclaw-hook.js --verbose
105
+ ```
106
+
107
+ ## Architecture
108
+
109
+ ```
110
+ OpenClaw session files (.jsonl)
111
+
112
+
113
+ SessionTailer (fs.watch)
114
+ │ new lines
115
+
116
+ extractContent()
117
+ │ text + role
118
+
119
+ ClawMoat.scanInbound/scanOutbound()
120
+
121
+ ┌────┴────┐
122
+ │ │
123
+ CLEAN THREAT
124
+ │ │
125
+ audit audit + cloud POST
126
+ log │
127
+ reportToCloud()
128
+
129
+ app.clawmoat.com
130
+ /api/scan
131
+ ```