@@ -13,9 +13,20 @@ This is **not** an OS sandbox. If an agent/runtime can access the filesystem/net
1313
1414## Installation
1515
16+ ### From local development (recommended during alpha)
17+
18+ ``` bash
19+ # Link the local package
20+ openclaw plugins install --link /path/to/hushclaw/packages/clawdstrike-openclaw
21+
22+ # Enable the plugin
23+ openclaw plugins enable clawdstrike-security
24+ ```
25+
26+ ### From npm (when published)
27+
1628``` bash
17- npm install @clawdstrike/openclaw
18- openclaw plugins enable @clawdstrike/openclaw
29+ openclaw plugins install @clawdstrike/clawdstrike-security
1930```
2031
2132## Quick Start
@@ -46,72 +57,58 @@ on_violation: cancel
4657
4758### 2. Configure OpenClaw
4859
49- Add to your ` openclaw.json`:
60+ Add to your ` ~/.openclaw/ openclaw.json`:
5061
5162` ` ` json
5263{
5364 "plugins": {
5465 "entries": {
55- "@ clawdstrike/openclaw ": {
66+ "clawdstrike-security ": {
5667 "enabled": true,
5768 "config": {
58- "policy": "./.hush/policy.yaml"
69+ "policy": "./.hush/policy.yaml",
70+ "mode": "deterministic"
5971 }
6072 }
6173 }
6274 }
6375}
6476` ` `
6577
66- # ## 3. Start OpenClaw
78+ # ## 3. Restart Gateway (if running)
6779
6880` ` ` bash
69- openclaw start
81+ openclaw gateway restart
7082` ` `
7183
7284Clawdstrike is now configured for your OpenClaw runtime.
7385
7486# # Verify It Works
7587
76- Ask your agent : " Try to read ~/.ssh/id_rsa" (via whatever file-reading tool OpenClaw provides).
77-
78- Expected behavior : the tool result should be blocked/redacted and you should see a message indicating the `forbidden_path` guard denied it.
79-
80- # # Using the CLI
81-
82- # ## Validate Your Policy
88+ # ## Using the CLI
8389
8490` ` ` bash
85- clawdstrike policy lint .hush/policy.yaml
86- ` ` `
91+ # Check plugin status
92+ openclaw clawdstrike status
8793
88- # ## Test an Event
94+ # Test a policy check
95+ openclaw clawdstrike check file_read ~/.ssh/id_rsa
96+ # → Denied by forbidden_path: Access to forbidden path...
8997
90- Create `test-event.json` :
91- ` ` ` json
92- {
93- "eventId": "example-1",
94- "eventType": "file_read",
95- "timestamp": "2026-02-02T00:00:00Z",
96- "data": { "type": "file", "path": "~/.ssh/id_rsa", "operation": "read" }
97- }
98+ openclaw clawdstrike check file_read /tmp/test.txt
99+ # → Action allowed
98100` ` `
99101
100- ` ` ` bash
101- clawdstrike policy test test-event.json --policy .hush/policy.yaml
102- ` ` `
102+ # ## Using an Agent
103103
104- # ## Query Audit Log
104+ Ask your agent to use the policy_check tool :
105105
106106` ` ` bash
107- clawdstrike audit query --denied
107+ openclaw agent --local --session-id test \
108+ --message "Use policy_check to check if reading ~/.ssh/id_rsa is allowed"
108109` ` `
109110
110- # ## Explain a Block
111-
112- ` ` ` bash
113- clawdstrike why <event-id>
114- ` ` `
111+ Expected : The agent uses `policy_check` and reports that access is denied by the `forbidden_path` guard.
115112
116113# # Agent Tools
117114
@@ -120,15 +117,25 @@ clawdstrike why <event-id>
120117Agents can use the `policy_check` tool to check permissions before attempting operations :
121118
122119` ` `
123- policy_check({ action: "file_write", resource: "/etc/passwd" })
124- -> { allowed: false, denied: true, warn: false, guard: "forbidden_path", message: "Denied by forbidden_path: …" }
120+ policy_check({ action: "file_read", resource: "~/.ssh/id_rsa" })
121+ → {
122+ "allowed": false,
123+ "denied": true,
124+ "guard": "forbidden_path",
125+ "message": "Denied by forbidden_path: Access to forbidden path...",
126+ "suggestion": "SSH keys are protected. Consider using a different credential storage method."
127+ }
125128` ` `
126129
127- The tool provides :
130+ **Parameters:**
131+ - `action` : One of `file_read`, `file_write`, `network`, `command`, `tool_call`
132+ - `resource` : The resource to check (file path, domain/URL, command string, or tool name)
133+
134+ **Response fields:**
128135- `allowed` : Whether the action is permitted
129136- `denied` : Whether the action is blocked
130- - `reason` / `message` : Human-readable explanation
131137- `guard` : Which guard made the decision
138+ - `reason` / `message` : Human-readable explanation
132139- `suggestion` : Helpful alternative approaches
133140
134141# # Policy Reference
@@ -173,7 +180,7 @@ on_violation: cancel # cancel | warn | log
173180
174181# # Built-in Rulesets
175182
176- Use predefined rulesets by extending them :
183+ Use predefined rulesets :
177184
178185` ` ` yaml
179186extends: clawdstrike:ai-agent-minimal
@@ -183,7 +190,34 @@ Available rulesets:
183190- ` clawdstrike:ai-agent-minimal` - Basic protection
184191- ` clawdstrike:ai-agent` - Standard development
185192
193+ # # Plugin Configuration Options
194+
195+ ` ` ` json
196+ {
197+ "clawdstrike-security": {
198+ "enabled": true,
199+ "config": {
200+ "policy": "./policy.yaml",
201+ "mode": "deterministic",
202+ "logLevel": "info",
203+ "guards": {
204+ "forbidden_path": true,
205+ "egress": true,
206+ "secret_leak": true,
207+ "patch_integrity": true
208+ }
209+ }
210+ }
211+ }
212+ ` ` `
213+
214+ - `policy` : Path to policy YAML or built-in ruleset name
215+ - `mode` : ` deterministic` (block), `advisory` (warn), or `audit` (log only)
216+ - `logLevel` : ` debug` , `info`, `warn`, or `error`
217+ - `guards` : Enable/disable specific guards
218+
186219# # Next Steps
187220
188221- Check the [Examples](../examples/) directory
189- - Run `clawdstrike --help` to explore the plugin CLI surface
222+ - Run `openclaw clawdstrike --help` to explore CLI commands
223+ - See the main [Clawdstrike documentation](../../../../docs/src/reference/guards/README.md) for guard details
0 commit comments