clawmoat 0.2.1 → 0.4.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 (51) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/Dockerfile +22 -0
  3. package/README.md +134 -5
  4. package/SECURITY.md +63 -0
  5. package/docs/ai-agent-security-scanner.html +691 -0
  6. package/docs/apple-touch-icon.png +0 -0
  7. package/docs/blog/host-guardian-launch.html +345 -0
  8. package/docs/blog/host-guardian-launch.md +249 -0
  9. package/docs/blog/index.html +2 -0
  10. package/docs/blog/langchain-security-tutorial.html +319 -0
  11. package/docs/blog/owasp-agentic-ai-top10.html +2 -0
  12. package/docs/blog/securing-ai-agents.html +2 -0
  13. package/docs/compare.html +2 -0
  14. package/docs/favicon.png +0 -0
  15. package/docs/icon-192.png +0 -0
  16. package/docs/index.html +258 -65
  17. package/docs/integrations/langchain.html +2 -0
  18. package/docs/integrations/openai.html +2 -0
  19. package/docs/integrations/openclaw.html +2 -0
  20. package/docs/logo.png +0 -0
  21. package/docs/logo.svg +60 -0
  22. package/docs/mark-with-moat.svg +33 -0
  23. package/docs/mark.png +0 -0
  24. package/docs/mark.svg +30 -0
  25. package/docs/og-image.png +0 -0
  26. package/docs/playground.html +440 -0
  27. package/docs/positioning-v2.md +155 -0
  28. package/docs/report-demo.html +399 -0
  29. package/docs/thanks.html +2 -0
  30. package/examples/github-action-workflow.yml +94 -0
  31. package/logo.png +0 -0
  32. package/logo.svg +60 -0
  33. package/mark-with-moat.svg +33 -0
  34. package/mark.png +0 -0
  35. package/mark.svg +30 -0
  36. package/package.json +1 -1
  37. package/server/index.js +9 -5
  38. package/skill/README.md +57 -0
  39. package/skill/SKILL.md +49 -30
  40. package/skill/scripts/audit.sh +28 -0
  41. package/skill/scripts/scan.sh +32 -0
  42. package/skill/scripts/test.sh +13 -0
  43. package/src/guardian/index.js +542 -0
  44. package/src/index.js +37 -0
  45. package/src/scanners/excessive-agency.js +88 -0
  46. package/wiki/Architecture.md +103 -0
  47. package/wiki/CLI-Reference.md +167 -0
  48. package/wiki/FAQ.md +135 -0
  49. package/wiki/Home.md +70 -0
  50. package/wiki/Policy-Engine.md +229 -0
  51. package/wiki/Scanner-Modules.md +224 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.3.0] - 2025-02-18
6
+
7
+ ### Added
8
+ - **Excessive Agency Scanner (ASI02/ASI03)**: Advanced security scanning for AI agent behaviors with comprehensive test coverage
9
+ - **OpenClaw Skill Integration**: Security scanning capabilities specifically designed for AI agent sessions
10
+ - **CI/CD Workflow**: Automated testing and continuous integration setup
11
+ - **SVG Brand Assets**: New logo, mark, and mark-with-moat SVG assets for better branding
12
+
13
+ ### Changed
14
+ - **Renamed Pro Skill to Security Kit**: Better reflects the comprehensive security features
15
+ - **New Pricing Structure**:
16
+ - Pro Skill (Security Kit) now available as one-time $29 purchase
17
+ - Shield and Team subscriptions with 30-day trial period
18
+ - 14-day money-back guarantee
19
+ - **Improved Documentation**: Enhanced README with better feature descriptions and setup instructions
20
+
21
+ ### Fixed
22
+ - Checkout system now points to live Railway URL for better reliability
23
+ - Various styling improvements for better user experience
24
+
25
+ ### UI/UX Improvements
26
+ - Bigger, transparent SVG logo with left-aligned navigation
27
+ - More space between logo and navigation links
28
+ - Narrower pill-shaped "Get Access" button
29
+ - Enhanced "Join Waitlist" and "Get Started" button styling and functionality
30
+
31
+ ## [0.2.1] - Previous Release
32
+ - Initial stable release with core security features
package/Dockerfile ADDED
@@ -0,0 +1,22 @@
1
+ FROM node:20-alpine
2
+
3
+ # Set working directory
4
+ WORKDIR /app
5
+
6
+ # Install dependencies
7
+ COPY package.json ./
8
+ RUN npm install --omit=dev
9
+
10
+ # Copy source code
11
+ COPY . .
12
+
13
+ # Ensure CLI is executable
14
+ RUN chmod +x bin/clawmoat.js
15
+
16
+ # Environment variables
17
+ ENV NODE_ENV=production
18
+ ENV CLAWMOAT_POLICY=strict
19
+
20
+ # CLI entrypoint
21
+ ENTRYPOINT ["node", "bin/clawmoat.js"]
22
+
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  <p align="center">
2
- <img src="https://img.shields.io/badge/🏰-ClawMoat-0F172A?style=for-the-badge&labelColor=10B981" alt="ClawMoat">
2
+ <img src="logo.png" alt="ClawMoat" width="400">
3
3
  </p>
4
4
 
5
- <h1 align="center">🏰 ClawMoat</h1>
5
+ <h1 align="center">ClawMoat</h1>
6
6
  <p align="center"><strong>Security moat for AI agents</strong></p>
7
7
  <p align="center">Runtime protection against prompt injection, tool misuse, and data exfiltration.</p>
8
8
 
@@ -20,6 +20,21 @@
20
20
 
21
21
  ---
22
22
 
23
+ ## Why ClawMoat?
24
+
25
+ Building with **LangChain**, **CrewAI**, **AutoGen**, or **OpenAI Agents**? Your agents have real capabilities — shell access, file I/O, web browsing, email. That's powerful, but one prompt injection in an email or scraped webpage can hijack your agent into exfiltrating secrets, running malicious commands, or poisoning its own memory.
26
+
27
+ **ClawMoat is the missing security layer.** Drop it in front of your agent and get:
28
+
29
+ - 🛡️ **Prompt injection detection** — multi-layer scanning catches instruction overrides, delimiter attacks, encoded payloads
30
+ - 🔐 **Secret & PII scanning** — 30+ credential patterns + PII detection on outbound text
31
+ - ⚡ **Zero dependencies** — pure Node.js, no ML models to download, sub-millisecond scans
32
+ - 🔧 **CI/CD ready** — GitHub Actions workflow included, fail builds on security violations
33
+ - 📋 **Policy engine** — YAML-based rules for shell, file, browser, and network access
34
+ - 🏰 **OWASP coverage** — maps to all 10 risks in the OWASP Top 10 for Agentic AI
35
+
36
+ **Works with any agent framework.** ClawMoat scans text — it doesn't care if it came from LangChain, CrewAI, AutoGen, or your custom agent.
37
+
23
38
  ## The Problem
24
39
 
25
40
  AI agents have shell access, browser control, email, and file system access. A single prompt injection in an email or webpage can hijack your agent into exfiltrating data, running malicious commands, or impersonating you.
@@ -54,6 +69,36 @@ openclaw skills add clawmoat
54
69
 
55
70
  Automatically scans inbound messages, audits tool calls, blocks violations, and logs events.
56
71
 
72
+ ## GitHub Action
73
+
74
+ Add ClawMoat to your CI pipeline to catch prompt injection and secret leaks before they merge:
75
+
76
+ ```yaml
77
+ # .github/workflows/clawmoat.yml
78
+ name: ClawMoat Scan
79
+ on: [pull_request]
80
+
81
+ permissions:
82
+ contents: read
83
+ pull-requests: write
84
+
85
+ jobs:
86
+ scan:
87
+ runs-on: ubuntu-latest
88
+ steps:
89
+ - uses: actions/checkout@v4
90
+ - uses: actions/setup-node@v4
91
+ with:
92
+ node-version: '20'
93
+ - uses: darfaz/clawmoat/.github/actions/scan@main
94
+ with:
95
+ paths: '.'
96
+ fail-on: 'critical' # critical | high | medium | low | none
97
+ format: 'summary'
98
+ ```
99
+
100
+ Results appear as PR comments and job summaries. See [`examples/github-action-workflow.yml`](examples/github-action-workflow.yml) for more patterns.
101
+
57
102
  ## Features
58
103
 
59
104
  | Feature | Description | Status |
@@ -63,7 +108,90 @@ Automatically scans inbound messages, audits tool calls, blocks violations, and
63
108
  | 📋 **Policy Engine** | YAML rules for shell, files, browser, network | ✅ v0.1 |
64
109
  | 🕵️ **Jailbreak Detection** | Heuristic + classifier pipeline | ✅ v0.1 |
65
110
  | 📊 **Session Audit Trail** | Full tamper-evident action log | ✅ v0.1 |
66
- | 🧠 **Behavioral Analysis** | Anomaly detection on agent behavior | 🔜 v0.3 |
111
+ | 🧠 **Behavioral Analysis** | Anomaly detection on agent behavior | 🔜 v0.5 |
112
+ | 🏠 **Host Guardian** | Runtime security for laptop-hosted agents | ✅ v0.4 |
113
+
114
+ ## 🏠 Host Guardian — Security for Laptop-Hosted Agents
115
+
116
+ Running an AI agent on your actual laptop? **Host Guardian** is the trust layer that makes it safe. It monitors every file access, command, and network request — blocking dangerous actions before they execute.
117
+
118
+ ### Permission Tiers
119
+
120
+ Start locked down, open up as trust grows:
121
+
122
+ | Mode | File Read | File Write | Shell | Network | Use Case |
123
+ |------|-----------|------------|-------|---------|----------|
124
+ | **Observer** | Workspace only | ❌ | ❌ | ❌ | Testing a new agent |
125
+ | **Worker** | Workspace only | Workspace only | Safe commands | Fetch only | Daily use |
126
+ | **Standard** | System-wide | Workspace only | Most commands | ✅ | Power users |
127
+ | **Full** | Everything | Everything | Everything | ✅ | Audit-only mode |
128
+
129
+ ### Quick Start
130
+
131
+ ```js
132
+ const { HostGuardian } = require('clawmoat');
133
+
134
+ const guardian = new HostGuardian({ mode: 'standard' });
135
+
136
+ // Check before every tool call
137
+ guardian.check('read', { path: '~/.ssh/id_rsa' });
138
+ // => { allowed: false, reason: 'Protected zone: SSH keys', severity: 'critical' }
139
+
140
+ guardian.check('exec', { command: 'rm -rf /' });
141
+ // => { allowed: false, reason: 'Dangerous command blocked: Recursive force delete', severity: 'critical' }
142
+
143
+ guardian.check('exec', { command: 'git status' });
144
+ // => { allowed: true, decision: 'allow' }
145
+
146
+ // Runtime mode switching
147
+ guardian.setMode('worker'); // Lock down further
148
+
149
+ // Full audit trail
150
+ console.log(guardian.report());
151
+ ```
152
+
153
+ ### What It Protects
154
+
155
+ **🔒 Forbidden Zones** (always blocked):
156
+ - SSH keys, GPG keys, AWS/GCloud/Azure credentials
157
+ - Browser cookies & login data, password managers
158
+ - Crypto wallets, `.env` files, `.netrc`
159
+ - System files (`/etc/shadow`, `/etc/sudoers`)
160
+
161
+ **⚡ Dangerous Commands** (blocked by tier):
162
+ - Destructive: `rm -rf`, `mkfs`, `dd`
163
+ - Escalation: `sudo`, `chmod +s`, `su -`
164
+ - Network: reverse shells, `ngrok`, `curl | bash`
165
+ - Persistence: `crontab`, modifying `.bashrc`
166
+ - Exfiltration: `curl --data`, `scp` to unknown hosts
167
+
168
+ **📋 Audit Trail**: Every action recorded with timestamps, verdicts, and reasons. Generate reports anytime.
169
+
170
+ ### Configuration
171
+
172
+ ```js
173
+ const guardian = new HostGuardian({
174
+ mode: 'worker',
175
+ workspace: '~/.openclaw/workspace',
176
+ safeZones: ['~/projects', '~/Documents'], // Additional allowed paths
177
+ forbiddenZones: ['~/tax-returns'], // Custom protected paths
178
+ onViolation: (tool, args, verdict) => { // Alert callback
179
+ notify(`⚠️ Blocked: ${verdict.reason}`);
180
+ },
181
+ });
182
+ ```
183
+
184
+ Or via `clawmoat.yml`:
185
+
186
+ ```yaml
187
+ guardian:
188
+ mode: standard
189
+ workspace: ~/.openclaw/workspace
190
+ safe_zones:
191
+ - ~/projects
192
+ forbidden_zones:
193
+ - ~/tax-returns
194
+ ```
67
195
 
68
196
  ## Architecture
69
197
 
@@ -146,7 +274,7 @@ ClawMoat maps to the [OWASP Top 10 for Agentic AI (2026)](https://genai.owasp.or
146
274
  | OWASP Risk | Description | ClawMoat Protection | Status |
147
275
  |-----------|-------------|---------------------|--------|
148
276
  | **ASI01** | Prompt Injection & Manipulation | Multi-layer injection scanning on all inbound content | ✅ |
149
- | **ASI02** | Excessive Agency & Permissions | Policy engine enforces least-privilege per tool | ✅ |
277
+ | **ASI02** | Excessive Agency & Permissions | Escalation detection + policy engine enforces least-privilege | ✅ |
150
278
  | **ASI03** | Insecure Tool Use | Command validation & argument sanitization | ✅ |
151
279
  | **ASI04** | Insufficient Output Validation | Output scanning for secrets, PII, dangerous code | ✅ |
152
280
  | **ASI05** | Memory & Context Poisoning | Context integrity checks on memory retrievals | 🔜 |
@@ -167,7 +295,8 @@ clawmoat/
167
295
  │ │ ├── prompt-injection.js
168
296
  │ │ ├── jailbreak.js
169
297
  │ │ ├── secrets.js
170
- │ │ └── pii.js
298
+ │ │ ├── pii.js
299
+ │ │ └── excessive-agency.js
171
300
  │ ├── policies/ # Policy enforcement
172
301
  │ │ ├── engine.js
173
302
  │ │ ├── exec.js
package/SECURITY.md ADDED
@@ -0,0 +1,63 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |---------|--------------------|
7
+ | 0.1.x | ✅ Current release |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ If you discover a security vulnerability in ClawMoat, **please report it responsibly**.
12
+
13
+ ### How to Report
14
+
15
+ 1. **Email:** Send details to **security@clawmoat.com**
16
+ 2. **Subject line:** `[SECURITY] Brief description`
17
+ 3. **Include:**
18
+ - Description of the vulnerability
19
+ - Steps to reproduce
20
+ - Potential impact
21
+ - Suggested fix (if any)
22
+
23
+ ### What to Expect
24
+
25
+ - **Acknowledgment** within 48 hours
26
+ - **Assessment** within 7 days
27
+ - **Fix timeline** communicated within 14 days
28
+ - **Credit** in the release notes (unless you prefer anonymity)
29
+
30
+ ### What NOT to Do
31
+
32
+ - Do not open a public GitHub issue for security vulnerabilities
33
+ - Do not exploit the vulnerability beyond what's needed to demonstrate it
34
+ - Do not access or modify other users' data
35
+
36
+ ## Scope
37
+
38
+ The following are in scope:
39
+
40
+ - **Scanner bypasses** — Attacks that evade ClawMoat's detection
41
+ - **Policy engine bypasses** — Tool calls that circumvent policy rules
42
+ - **Audit log tampering** — Ways to modify or forge audit entries
43
+ - **Dependency issues** — Vulnerabilities in ClawMoat's dependencies (currently: none)
44
+
45
+ The following are out of scope:
46
+
47
+ - Denial of service via large inputs (expected behavior — use input size limits)
48
+ - False positives/negatives in detection (please open a regular issue)
49
+ - Vulnerabilities in upstream LLM providers
50
+
51
+ ## Security Best Practices
52
+
53
+ When using ClawMoat:
54
+
55
+ 1. Keep ClawMoat updated to the latest version
56
+ 2. Enable all relevant scanners for your use case
57
+ 3. Use strict policy configurations in production
58
+ 4. Review audit logs regularly
59
+ 5. Set up alerts for critical-severity findings
60
+
61
+ ## PGP Key
62
+
63
+ For encrypted communications, use our PGP key (available on request at security@clawmoat.com).