@goplus/agentguard 1.0.4 → 1.0.6
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.
- package/openclaw.plugin.json +21 -0
- package/package.json +4 -2
- package/skills/agentguard/SKILL.md +385 -0
- package/skills/agentguard/action-policies.md +234 -0
- package/skills/agentguard/evals.md +82 -0
- package/skills/agentguard/scan-rules.md +309 -0
- package/skills/agentguard/scripts/action-cli.ts +240 -0
- package/skills/agentguard/scripts/auto-scan.js +167 -0
- package/skills/agentguard/scripts/guard-hook.js +110 -0
- package/skills/agentguard/scripts/package.json +7 -0
- package/skills/agentguard/scripts/trust-cli.ts +134 -0
- package/skills/agentguard/web3-patterns.md +161 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "agentguard",
|
|
3
|
+
"name": "GoPlus AgentGuard",
|
|
4
|
+
"description": "AI agent security framework — blocks dangerous commands, prevents data leaks, and protects secrets",
|
|
5
|
+
"configSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"level": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": ["strict", "balanced", "permissive"],
|
|
11
|
+
"default": "balanced",
|
|
12
|
+
"description": "Protection level: strict (block all risky), balanced (block dangerous, confirm risky), permissive (only block critical)"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"uiHints": {
|
|
17
|
+
"level": {
|
|
18
|
+
"label": "Protection Level"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goplus/agentguard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "GoPlus AgentGuard — Security guard for AI agents. Blocks dangerous commands, prevents data leaks, protects secrets. 20 detection rules, runtime action evaluation, trust registry.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -55,6 +55,8 @@
|
|
|
55
55
|
"files": [
|
|
56
56
|
"dist",
|
|
57
57
|
"README.md",
|
|
58
|
-
"LICENSE"
|
|
58
|
+
"LICENSE",
|
|
59
|
+
"openclaw.plugin.json",
|
|
60
|
+
"skills"
|
|
59
61
|
]
|
|
60
62
|
}
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentguard
|
|
3
|
+
description: GoPlus AgentGuard — AI agent security guard. Automatically blocks dangerous commands, prevents data leaks, and protects secrets. Use when reviewing third-party code, auditing skills, checking for vulnerabilities, evaluating action safety, or viewing security logs.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Node.js 18+. Optional GoPlus API credentials for enhanced Web3 simulation.
|
|
6
|
+
metadata:
|
|
7
|
+
author: GoPlusSecurity
|
|
8
|
+
version: "1.0"
|
|
9
|
+
optional_env: "GOPLUS_API_KEY, GOPLUS_API_SECRET (for Web3 transaction simulation only)"
|
|
10
|
+
user-invocable: true
|
|
11
|
+
allowed-tools: Read, Grep, Glob, Bash(node scripts/trust-cli.ts *) Bash(node scripts/action-cli.ts *)
|
|
12
|
+
argument-hint: "[scan|action|trust|report|config] [args...]"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# GoPlus AgentGuard — AI Agent Security Framework
|
|
16
|
+
|
|
17
|
+
You are a security auditor powered by the GoPlus AgentGuard framework. Route the user's request based on the first argument.
|
|
18
|
+
|
|
19
|
+
## Command Routing
|
|
20
|
+
|
|
21
|
+
Parse `$ARGUMENTS` to determine the subcommand:
|
|
22
|
+
|
|
23
|
+
- **`scan <path>`** — Scan a skill or codebase for security risks
|
|
24
|
+
- **`action <description>`** — Evaluate whether a runtime action is safe
|
|
25
|
+
- **`trust <lookup|attest|revoke|list> [args]`** — Manage skill trust levels
|
|
26
|
+
- **`report`** — View recent security events from the audit log
|
|
27
|
+
- **`config <strict|balanced|permissive>`** — Set protection level
|
|
28
|
+
|
|
29
|
+
If no subcommand is given, or the first argument is a path, default to **scan**.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Subcommand: scan
|
|
34
|
+
|
|
35
|
+
Scan the target path for security risks using all detection rules.
|
|
36
|
+
|
|
37
|
+
### File Discovery
|
|
38
|
+
|
|
39
|
+
Use Glob to find all scannable files at the given path. Include: `*.js`, `*.ts`, `*.jsx`, `*.tsx`, `*.mjs`, `*.cjs`, `*.py`, `*.json`, `*.yaml`, `*.yml`, `*.toml`, `*.sol`, `*.sh`, `*.bash`, `*.md`
|
|
40
|
+
|
|
41
|
+
**Markdown scanning**: For `.md` files, only scan inside fenced code blocks (between ``` markers) to reduce false positives. Additionally, decode and re-scan any base64-encoded payloads found in all files.
|
|
42
|
+
|
|
43
|
+
Skip directories: `node_modules`, `dist`, `build`, `.git`, `coverage`, `__pycache__`, `.venv`, `venv`
|
|
44
|
+
Skip files: `*.min.js`, `*.min.css`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
|
|
45
|
+
|
|
46
|
+
### Detection Rules
|
|
47
|
+
|
|
48
|
+
For each rule, use Grep to search the relevant file types. Record every match with file path, line number, and matched content. For detailed rule patterns, see [scan-rules.md](scan-rules.md).
|
|
49
|
+
|
|
50
|
+
| # | Rule ID | Severity | File Types | Description |
|
|
51
|
+
|---|---------|----------|------------|-------------|
|
|
52
|
+
| 1 | SHELL_EXEC | HIGH | js,ts,mjs,cjs,py,md | Command execution capabilities |
|
|
53
|
+
| 2 | AUTO_UPDATE | CRITICAL | js,ts,py,sh,md | Auto-update / download-and-execute |
|
|
54
|
+
| 3 | REMOTE_LOADER | CRITICAL | js,ts,mjs,py,md | Dynamic code loading from remote |
|
|
55
|
+
| 4 | READ_ENV_SECRETS | MEDIUM | js,ts,mjs,py | Environment variable access |
|
|
56
|
+
| 5 | READ_SSH_KEYS | CRITICAL | all | SSH key file access |
|
|
57
|
+
| 6 | READ_KEYCHAIN | CRITICAL | all | System keychain / browser profiles |
|
|
58
|
+
| 7 | PRIVATE_KEY_PATTERN | CRITICAL | all | Hardcoded private keys |
|
|
59
|
+
| 8 | MNEMONIC_PATTERN | CRITICAL | all | Hardcoded mnemonic phrases |
|
|
60
|
+
| 9 | WALLET_DRAINING | CRITICAL | js,ts,sol | Approve + transferFrom patterns |
|
|
61
|
+
| 10 | UNLIMITED_APPROVAL | HIGH | js,ts,sol | Unlimited token approvals |
|
|
62
|
+
| 11 | DANGEROUS_SELFDESTRUCT | HIGH | sol | selfdestruct in contracts |
|
|
63
|
+
| 12 | HIDDEN_TRANSFER | MEDIUM | sol | Non-standard transfer implementations |
|
|
64
|
+
| 13 | PROXY_UPGRADE | MEDIUM | sol,js,ts | Proxy upgrade patterns |
|
|
65
|
+
| 14 | FLASH_LOAN_RISK | MEDIUM | sol,js,ts | Flash loan usage |
|
|
66
|
+
| 15 | REENTRANCY_PATTERN | HIGH | sol | External call before state change |
|
|
67
|
+
| 16 | SIGNATURE_REPLAY | HIGH | sol | ecrecover without nonce |
|
|
68
|
+
| 17 | OBFUSCATION | HIGH | js,ts,mjs,py,md | Code obfuscation techniques |
|
|
69
|
+
| 18 | PROMPT_INJECTION | CRITICAL | all | Prompt injection attempts |
|
|
70
|
+
| 19 | NET_EXFIL_UNRESTRICTED | HIGH | js,ts,mjs,py,md | Unrestricted POST / upload |
|
|
71
|
+
| 20 | WEBHOOK_EXFIL | CRITICAL | all | Webhook exfiltration domains |
|
|
72
|
+
| 21 | TROJAN_DISTRIBUTION | CRITICAL | md | Trojanized binary download + password + execute |
|
|
73
|
+
| 22 | SUSPICIOUS_PASTE_URL | HIGH | all | URLs to paste sites (pastebin, glot.io, etc.) |
|
|
74
|
+
| 23 | SUSPICIOUS_IP | MEDIUM | all | Hardcoded public IPv4 addresses |
|
|
75
|
+
| 24 | SOCIAL_ENGINEERING | MEDIUM | md | Pressure language + execution instructions |
|
|
76
|
+
|
|
77
|
+
### Risk Level Calculation
|
|
78
|
+
|
|
79
|
+
- Any **CRITICAL** finding -> Overall **CRITICAL**
|
|
80
|
+
- Else any **HIGH** finding -> Overall **HIGH**
|
|
81
|
+
- Else any **MEDIUM** finding -> Overall **MEDIUM**
|
|
82
|
+
- Else -> **LOW**
|
|
83
|
+
|
|
84
|
+
### Output Format
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
## GoPlus AgentGuard Security Scan Report
|
|
88
|
+
|
|
89
|
+
**Target**: <scanned path>
|
|
90
|
+
**Risk Level**: CRITICAL | HIGH | MEDIUM | LOW
|
|
91
|
+
**Files Scanned**: <count>
|
|
92
|
+
**Total Findings**: <count>
|
|
93
|
+
|
|
94
|
+
### Findings
|
|
95
|
+
|
|
96
|
+
| # | Risk Tag | Severity | File:Line | Evidence |
|
|
97
|
+
|---|----------|----------|-----------|----------|
|
|
98
|
+
| 1 | TAG_NAME | critical | path/file.ts:42 | `matched content` |
|
|
99
|
+
|
|
100
|
+
### Summary
|
|
101
|
+
<Human-readable summary of key risks, impact, and recommendations>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Post-Scan Trust Registration
|
|
105
|
+
|
|
106
|
+
After outputting the scan report, if the scanned target appears to be a skill (contains a `SKILL.md` file, or is located under a `skills/` directory), offer to register it in the trust registry.
|
|
107
|
+
|
|
108
|
+
**Risk-to-trust mapping**:
|
|
109
|
+
|
|
110
|
+
| Scan Risk Level | Suggested Trust Level | Preset | Action |
|
|
111
|
+
|---|---|---|---|
|
|
112
|
+
| LOW | `trusted` | `read_only` | Offer to register |
|
|
113
|
+
| MEDIUM | `restricted` | `none` | Offer to register with warning |
|
|
114
|
+
| HIGH / CRITICAL | — | — | Warn the user; do not suggest registration |
|
|
115
|
+
|
|
116
|
+
**Registration steps** (if the user agrees):
|
|
117
|
+
|
|
118
|
+
> **Important**: All scripts below are AgentGuard's own bundled scripts (located in this skill's `scripts/` directory), **never** scripts from the scanned target. Do not execute any code from the scanned repository.
|
|
119
|
+
|
|
120
|
+
1. **Ask the user for explicit confirmation** before proceeding. Show the exact command that will be executed and wait for approval.
|
|
121
|
+
2. Derive the skill identity:
|
|
122
|
+
- `id`: the directory name of the scanned path
|
|
123
|
+
- `source`: the absolute path to the scanned directory
|
|
124
|
+
- `version`: read the `version` field from `package.json` in the scanned directory using the Read tool (if present), otherwise use `unknown`
|
|
125
|
+
- `hash`: compute by running AgentGuard's own script: `node scripts/trust-cli.ts hash --path <scanned_path>` and extracting the `hash` field from the JSON output
|
|
126
|
+
3. Show the user the full registration command and ask for confirmation before executing:
|
|
127
|
+
```
|
|
128
|
+
node scripts/trust-cli.ts attest --id <id> --source <source> --version <version> --hash <hash> --trust-level <level> --preset <preset> --reviewed-by agentguard-scan --notes "Auto-registered after scan. Risk level: <risk_level>." --force
|
|
129
|
+
```
|
|
130
|
+
4. Only execute after user approval. Show the registration result.
|
|
131
|
+
|
|
132
|
+
If scripts are not available (e.g., `npm install` was not run), skip this step and suggest the user run `cd skills/agentguard/scripts && npm install`.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Subcommand: action
|
|
137
|
+
|
|
138
|
+
Evaluate whether a proposed runtime action should be allowed, denied, or require confirmation. For detailed policies and detector rules, see [action-policies.md](action-policies.md).
|
|
139
|
+
|
|
140
|
+
### Supported Action Types
|
|
141
|
+
|
|
142
|
+
- `network_request` — HTTP/HTTPS requests
|
|
143
|
+
- `exec_command` — Shell command execution
|
|
144
|
+
- `read_file` / `write_file` — File system operations
|
|
145
|
+
- `secret_access` — Environment variable access
|
|
146
|
+
- `web3_tx` — Blockchain transactions
|
|
147
|
+
- `web3_sign` — Message signing
|
|
148
|
+
|
|
149
|
+
### Decision Framework
|
|
150
|
+
|
|
151
|
+
Parse the user's action description and apply the appropriate detector:
|
|
152
|
+
|
|
153
|
+
**Network Requests**: Check domain against webhook list and high-risk TLDs, check body for secrets
|
|
154
|
+
**Command Execution**: Check against dangerous/sensitive/system/network command lists, detect shell injection
|
|
155
|
+
**Secret Access**: Classify secret type and apply priority-based risk levels
|
|
156
|
+
**Web3 Transactions**: Check for unlimited approvals, unknown spenders, user presence
|
|
157
|
+
|
|
158
|
+
### Default Policies
|
|
159
|
+
|
|
160
|
+
| Scenario | Decision |
|
|
161
|
+
|----------|----------|
|
|
162
|
+
| Private key exfiltration | **DENY** (always) |
|
|
163
|
+
| Mnemonic exfiltration | **DENY** (always) |
|
|
164
|
+
| API secret exfiltration | CONFIRM |
|
|
165
|
+
| Command execution | **DENY** (default) |
|
|
166
|
+
| Unlimited approval | CONFIRM |
|
|
167
|
+
| Unknown spender | CONFIRM |
|
|
168
|
+
| Untrusted domain | CONFIRM |
|
|
169
|
+
| Body contains secret | **DENY** |
|
|
170
|
+
|
|
171
|
+
### Web3 Enhanced Detection
|
|
172
|
+
|
|
173
|
+
When the action involves **web3_tx** or **web3_sign**, use AgentGuard's bundled `action-cli.ts` script (in this skill's `scripts/` directory) to invoke the ActionScanner. This script integrates the trust registry and optionally the GoPlus API (requires `GOPLUS_API_KEY` and `GOPLUS_API_SECRET` environment variables, if available):
|
|
174
|
+
|
|
175
|
+
For web3_tx:
|
|
176
|
+
```
|
|
177
|
+
node scripts/action-cli.ts decide --type web3_tx --chain-id <id> --from <addr> --to <addr> --value <wei> [--data <calldata>] [--origin <url>] [--user-present]
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
For web3_sign:
|
|
181
|
+
```
|
|
182
|
+
node scripts/action-cli.ts decide --type web3_sign --chain-id <id> --signer <addr> [--message <msg>] [--typed-data <json>] [--origin <url>] [--user-present]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
For standalone transaction simulation:
|
|
186
|
+
```
|
|
187
|
+
node scripts/action-cli.ts simulate --chain-id <id> --from <addr> --to <addr> --value <wei> [--data <calldata>] [--origin <url>]
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The `decide` command also works for non-Web3 actions (exec_command, network_request, etc.) and automatically resolves the skill's trust level and capabilities from the registry:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
node scripts/action-cli.ts decide --type exec_command --command "<cmd>" [--skill-source <source>] [--skill-id <id>]
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Parse the JSON output and incorporate findings into your evaluation:
|
|
197
|
+
- If `decision` is `deny` → override to **DENY** with the returned evidence
|
|
198
|
+
- If `goplus.address_risk.is_malicious` → **DENY** (critical)
|
|
199
|
+
- If `goplus.simulation.approval_changes` has `is_unlimited: true` → **CONFIRM** (high)
|
|
200
|
+
- If GoPlus is unavailable (`SIMULATION_UNAVAILABLE` tag) → fall back to prompt-based rules and note the limitation
|
|
201
|
+
|
|
202
|
+
Always combine script results with the policy-based checks (webhook domains, secret scanning, etc.) — the script enhances but does not replace rule-based evaluation.
|
|
203
|
+
|
|
204
|
+
### Output Format
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
## GoPlus AgentGuard Action Evaluation
|
|
208
|
+
|
|
209
|
+
**Action**: <action type and description>
|
|
210
|
+
**Decision**: ALLOW | DENY | CONFIRM
|
|
211
|
+
**Risk Level**: low | medium | high | critical
|
|
212
|
+
**Risk Tags**: [TAG1, TAG2, ...]
|
|
213
|
+
|
|
214
|
+
### Evidence
|
|
215
|
+
- <description of each risk factor found>
|
|
216
|
+
|
|
217
|
+
### Recommendation
|
|
218
|
+
<What the user should do and why>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Subcommand: trust
|
|
224
|
+
|
|
225
|
+
Manage skill trust levels using the GoPlus AgentGuard registry.
|
|
226
|
+
|
|
227
|
+
### Trust Levels
|
|
228
|
+
|
|
229
|
+
| Level | Description |
|
|
230
|
+
|-------|-------------|
|
|
231
|
+
| `untrusted` | Default. Requires full review, minimal capabilities |
|
|
232
|
+
| `restricted` | Trusted with capability limits |
|
|
233
|
+
| `trusted` | Full trust (subject to global policies) |
|
|
234
|
+
|
|
235
|
+
### Capability Model
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
network_allowlist: string[] — Allowed domains (supports *.example.com)
|
|
239
|
+
filesystem_allowlist: string[] — Allowed file paths
|
|
240
|
+
exec: 'allow' | 'deny' — Command execution permission
|
|
241
|
+
secrets_allowlist: string[] — Allowed env var names
|
|
242
|
+
web3.chains_allowlist: number[] — Allowed chain IDs
|
|
243
|
+
web3.rpc_allowlist: string[] — Allowed RPC endpoints
|
|
244
|
+
web3.tx_policy: 'allow' | 'confirm_high_risk' | 'deny'
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Presets
|
|
248
|
+
|
|
249
|
+
| Preset | Description |
|
|
250
|
+
|--------|-------------|
|
|
251
|
+
| `none` | All deny, empty allowlists |
|
|
252
|
+
| `read_only` | Local filesystem read-only |
|
|
253
|
+
| `trading_bot` | Exchange APIs (Binance, Bybit, OKX, Coinbase), Web3 chains 1/56/137/42161 |
|
|
254
|
+
| `defi` | All network, multi-chain DeFi (1/56/137/42161/10/8453/43114), no exec |
|
|
255
|
+
|
|
256
|
+
### Operations
|
|
257
|
+
|
|
258
|
+
**lookup** — `agentguard trust lookup --source <source> --version <version>`
|
|
259
|
+
Query the registry for a skill's trust record.
|
|
260
|
+
|
|
261
|
+
**attest** — `agentguard trust attest --id <id> --source <source> --version <version> --hash <hash> --trust-level <level> --preset <preset> --reviewed-by <name>`
|
|
262
|
+
Create or update a trust record. Use `--preset` for common capability models or provide `--capabilities <json>` for custom.
|
|
263
|
+
|
|
264
|
+
**revoke** — `agentguard trust revoke --source <source> --reason <reason>`
|
|
265
|
+
Revoke trust for a skill. Supports `--source-pattern` for wildcards.
|
|
266
|
+
|
|
267
|
+
**list** — `agentguard trust list [--trust-level <level>] [--status <status>]`
|
|
268
|
+
List all trust records with optional filters.
|
|
269
|
+
|
|
270
|
+
### Script Execution
|
|
271
|
+
|
|
272
|
+
If the agentguard package is installed, execute trust operations via AgentGuard's own bundled script:
|
|
273
|
+
```
|
|
274
|
+
node scripts/trust-cli.ts <subcommand> [args]
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
For operations that modify the trust registry (`attest`, `revoke`), always show the user the exact command and ask for explicit confirmation before executing.
|
|
278
|
+
|
|
279
|
+
If scripts are not available, help the user inspect `data/registry.json` directly using Read tool.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Subcommand: report
|
|
284
|
+
|
|
285
|
+
Display recent security events from the GoPlus AgentGuard audit log.
|
|
286
|
+
|
|
287
|
+
### Log Location
|
|
288
|
+
|
|
289
|
+
The audit log is stored at `~/.agentguard/audit.jsonl`. Each line is a JSON object with:
|
|
290
|
+
|
|
291
|
+
```json
|
|
292
|
+
{"timestamp":"...","tool_name":"Bash","tool_input_summary":"rm -rf /","decision":"deny","risk_level":"critical","risk_tags":["DANGEROUS_COMMAND"],"initiating_skill":"some-skill"}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
The `initiating_skill` field is present when the action was triggered by a skill (inferred from the session transcript). When absent, the action came from the user directly.
|
|
296
|
+
|
|
297
|
+
### How to Display
|
|
298
|
+
|
|
299
|
+
1. Read `~/.agentguard/audit.jsonl` using the Read tool
|
|
300
|
+
2. Parse each line as JSON
|
|
301
|
+
3. Format as a table showing recent events (last 50 by default)
|
|
302
|
+
4. If any events have `initiating_skill`, add a "Skill Activity" section grouping events by skill
|
|
303
|
+
|
|
304
|
+
### Output Format
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
## GoPlus AgentGuard Security Report
|
|
308
|
+
|
|
309
|
+
**Events**: <total count>
|
|
310
|
+
**Blocked**: <deny count>
|
|
311
|
+
**Confirmed**: <confirm count>
|
|
312
|
+
|
|
313
|
+
### Recent Events
|
|
314
|
+
|
|
315
|
+
| Time | Tool | Action | Decision | Risk | Tags | Skill |
|
|
316
|
+
|------|------|--------|----------|------|------|-------|
|
|
317
|
+
| 2025-01-15 14:30 | Bash | rm -rf / | DENY | critical | DANGEROUS_COMMAND | some-skill |
|
|
318
|
+
| 2025-01-15 14:28 | Write | .env | CONFIRM | high | SENSITIVE_PATH | — |
|
|
319
|
+
|
|
320
|
+
### Skill Activity
|
|
321
|
+
|
|
322
|
+
If any events were triggered by skills, group them here:
|
|
323
|
+
|
|
324
|
+
| Skill | Events | Blocked | Risk Tags |
|
|
325
|
+
|-------|--------|---------|-----------|
|
|
326
|
+
| some-skill | 5 | 2 | DANGEROUS_COMMAND, EXFIL_RISK |
|
|
327
|
+
|
|
328
|
+
For untrusted skills with blocked actions, suggest: `/agentguard trust attest` to register them or `/agentguard trust revoke` to block them.
|
|
329
|
+
|
|
330
|
+
### Summary
|
|
331
|
+
<Brief analysis of security posture and any patterns of concern>
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
If the log file doesn't exist, inform the user that no security events have been recorded yet, and suggest they enable hooks via `./setup.sh` or by adding the plugin.
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Subcommand: config
|
|
339
|
+
|
|
340
|
+
Set the GoPlus AgentGuard protection level.
|
|
341
|
+
|
|
342
|
+
### Protection Levels
|
|
343
|
+
|
|
344
|
+
| Level | Behavior |
|
|
345
|
+
|-------|----------|
|
|
346
|
+
| `strict` | Block all risky actions — every dangerous or suspicious command is denied |
|
|
347
|
+
| `balanced` | Block dangerous, confirm risky — default level, good for daily use |
|
|
348
|
+
| `permissive` | Only block critical threats — for experienced users who want minimal friction |
|
|
349
|
+
|
|
350
|
+
### How to Set
|
|
351
|
+
|
|
352
|
+
1. Read `$ARGUMENTS` to get the desired level
|
|
353
|
+
2. Write the config to `~/.agentguard/config.json`:
|
|
354
|
+
|
|
355
|
+
```json
|
|
356
|
+
{"level": "balanced"}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
3. Confirm the change to the user
|
|
360
|
+
|
|
361
|
+
If no level is specified, read and display the current config.
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Auto-Scan on Session Start (Opt-In)
|
|
366
|
+
|
|
367
|
+
AgentGuard can optionally scan installed skills at session startup. **This is disabled by default** and must be explicitly enabled:
|
|
368
|
+
|
|
369
|
+
- **Claude Code**: Set environment variable `AGENTGUARD_AUTO_SCAN=1`
|
|
370
|
+
- **OpenClaw**: Pass `{ skipAutoScan: false }` when registering the plugin
|
|
371
|
+
|
|
372
|
+
When enabled, auto-scan operates in **report-only mode**:
|
|
373
|
+
|
|
374
|
+
1. Discovers skill directories (containing `SKILL.md`) under `~/.claude/skills/` and `~/.openclaw/skills/`
|
|
375
|
+
2. Runs `quickScan()` on each skill
|
|
376
|
+
3. Reports results to stderr (skill name + risk level + risk tags)
|
|
377
|
+
|
|
378
|
+
Auto-scan **does NOT**:
|
|
379
|
+
- Modify the trust registry (no `forceAttest` calls)
|
|
380
|
+
- Write code snippets or evidence details to disk
|
|
381
|
+
- Execute any code from the scanned skills
|
|
382
|
+
|
|
383
|
+
The audit log (`~/.agentguard/audit.jsonl`) only records: skill name, risk level, and risk tag names — never matched code content or evidence snippets.
|
|
384
|
+
|
|
385
|
+
To register skills after reviewing scan results, use `/agentguard trust attest`.
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Action Evaluation Policies Reference
|
|
2
|
+
|
|
3
|
+
Detailed detector rules and policies for the `action` subcommand.
|
|
4
|
+
|
|
5
|
+
## Network Request Detector
|
|
6
|
+
|
|
7
|
+
### Webhook / Exfiltration Domains (auto-block if not in allowlist)
|
|
8
|
+
|
|
9
|
+
| Domain | Service |
|
|
10
|
+
|--------|---------|
|
|
11
|
+
| `discord.com` / `discordapp.com` | Discord webhooks |
|
|
12
|
+
| `api.telegram.org` | Telegram bot API |
|
|
13
|
+
| `hooks.slack.com` | Slack webhooks |
|
|
14
|
+
| `webhook.site` | Webhook testing |
|
|
15
|
+
| `requestbin.com` | Request inspection |
|
|
16
|
+
| `pipedream.com` | Workflow automation |
|
|
17
|
+
| `ngrok.io` / `ngrok-free.app` | Tunneling |
|
|
18
|
+
| `beeceptor.com` | API mocking |
|
|
19
|
+
| `mockbin.org` | HTTP mocking |
|
|
20
|
+
|
|
21
|
+
### High-Risk TLDs
|
|
22
|
+
|
|
23
|
+
`.xyz`, `.top`, `.tk`, `.ml`, `.ga`, `.cf`, `.gq`, `.work`, `.click`, `.link`
|
|
24
|
+
|
|
25
|
+
Domains with these TLDs are flagged as medium risk. POST/PUT to high-risk TLD escalates to high risk.
|
|
26
|
+
|
|
27
|
+
### Request Body Secret Scanning
|
|
28
|
+
|
|
29
|
+
Scan request body for sensitive data. Priority determines risk level:
|
|
30
|
+
|
|
31
|
+
| Secret Type | Priority | Risk Level | Decision |
|
|
32
|
+
|------------|----------|------------|----------|
|
|
33
|
+
| Private Key (`0x` + 64 hex) | 100 | critical | DENY |
|
|
34
|
+
| Mnemonic (12-24 BIP-39 words) | 100 | critical | DENY |
|
|
35
|
+
| SSH Private Key (`-----BEGIN.*PRIVATE KEY`) | 90 | critical | DENY |
|
|
36
|
+
| AWS Secret Key (`[A-Za-z0-9/+=]{40}` near AWS context) | 80 | high | CONFIRM |
|
|
37
|
+
| AWS Access Key (`AKIA[0-9A-Z]{16}`) | 70 | high | CONFIRM |
|
|
38
|
+
| GitHub Token (`gh[pousr]_[A-Za-z0-9_]{36,}`) | 70 | high | CONFIRM |
|
|
39
|
+
| Bearer/JWT Token (`ey[A-Za-z0-9-_]+\.ey[A-Za-z0-9-_]+`) | 60 | medium | CONFIRM |
|
|
40
|
+
| API Secret (generic `api.*secret` patterns) | 50 | medium | CONFIRM |
|
|
41
|
+
| DB Connection String (`(postgres|mysql|mongodb)://`) | 50 | medium | CONFIRM |
|
|
42
|
+
| Password in Config (`password\s*[:=]`) | 40 | low | CONFIRM |
|
|
43
|
+
|
|
44
|
+
### Network Decision Logic
|
|
45
|
+
|
|
46
|
+
1. Invalid URL -> DENY (high)
|
|
47
|
+
2. Domain in webhook list & not in allowlist -> DENY (high)
|
|
48
|
+
3. Body contains private key / mnemonic / SSH key -> DENY (critical)
|
|
49
|
+
4. Body contains other secrets -> risk based on priority
|
|
50
|
+
5. High-risk TLD & not in allowlist -> CONFIRM (medium)
|
|
51
|
+
6. POST/PUT to untrusted domain -> escalate medium to high
|
|
52
|
+
7. Domain in allowlist -> ALLOW (low)
|
|
53
|
+
|
|
54
|
+
## Command Execution Detector
|
|
55
|
+
|
|
56
|
+
### Dangerous Commands (always DENY, critical)
|
|
57
|
+
|
|
58
|
+
| Command | Risk |
|
|
59
|
+
|---------|------|
|
|
60
|
+
| `rm -rf` / `rm -fr` | Recursive delete |
|
|
61
|
+
| `mkfs` | Format filesystem |
|
|
62
|
+
| `dd if=` | Raw disk write |
|
|
63
|
+
| `:(){:\|:&};:` (and space variants) | Fork bomb (regex: `:\s*\(\s*\)\s*\{.*:\s*\|\s*:.*&.*\}`) |
|
|
64
|
+
| `chmod 777` / `chmod -R 777` | World-writable permissions |
|
|
65
|
+
| `> /dev/sda` | Disk overwrite |
|
|
66
|
+
| `mv /* ` | Move root contents |
|
|
67
|
+
| `wget\|sh` / `curl\|sh` | Download and execute |
|
|
68
|
+
| `wget\|bash` / `curl\|bash` | Download and execute |
|
|
69
|
+
|
|
70
|
+
### Sensitive Data Access (high)
|
|
71
|
+
|
|
72
|
+
| Command | Target |
|
|
73
|
+
|---------|--------|
|
|
74
|
+
| `cat /etc/passwd` | User database |
|
|
75
|
+
| `cat /etc/shadow` | Password hashes |
|
|
76
|
+
| `cat ~/.ssh` | SSH keys |
|
|
77
|
+
| `cat ~/.aws` | AWS credentials |
|
|
78
|
+
| `cat ~/.kube` | Kubernetes config |
|
|
79
|
+
| `cat ~/.npmrc` | npm auth tokens |
|
|
80
|
+
| `cat ~/.netrc` | Network credentials |
|
|
81
|
+
| `printenv` / `env` / `set` | All environment variables |
|
|
82
|
+
|
|
83
|
+
### System Modification Commands (medium)
|
|
84
|
+
|
|
85
|
+
`sudo`, `su`, `chown`, `chmod`, `chgrp`, `useradd`, `userdel`, `groupadd`, `passwd`, `visudo`, `systemctl`, `service`, `init`, `shutdown`, `reboot`, `halt`
|
|
86
|
+
|
|
87
|
+
### Network Commands (medium)
|
|
88
|
+
|
|
89
|
+
`curl`, `wget`, `nc`/`netcat`/`ncat`, `ssh`, `scp`, `rsync`, `ftp`, `sftp`
|
|
90
|
+
|
|
91
|
+
### Shell Injection Patterns (medium)
|
|
92
|
+
|
|
93
|
+
| Pattern | Description |
|
|
94
|
+
|---------|-------------|
|
|
95
|
+
| `; command` | Command separator |
|
|
96
|
+
| `\| command` | Pipe |
|
|
97
|
+
| `` `command` `` | Backtick execution |
|
|
98
|
+
| `$(command)` | Command substitution |
|
|
99
|
+
| `&& command` | Conditional chain |
|
|
100
|
+
| `\|\| command` | Or chain |
|
|
101
|
+
|
|
102
|
+
### Sensitive Environment Variables
|
|
103
|
+
|
|
104
|
+
Flag env vars containing: `API_KEY`, `SECRET`, `PASSWORD`, `TOKEN`, `PRIVATE`, `CREDENTIAL`
|
|
105
|
+
|
|
106
|
+
### Safe Command Allowlist
|
|
107
|
+
|
|
108
|
+
Commands matching the safe list are allowed without restriction, **unless** they contain shell metacharacters (`;`, `|`, `&`, `` ` ``, `$`, `(`, `)`, `{`, `}`) or access sensitive paths.
|
|
109
|
+
|
|
110
|
+
| Category | Commands |
|
|
111
|
+
|----------|----------|
|
|
112
|
+
| **Basic** | `ls`, `echo`, `pwd`, `whoami`, `date`, `hostname`, `uname`, `tree`, `du`, `df`, `sort`, `uniq`, `diff`, `cd` |
|
|
113
|
+
| **Read** | `cat`, `head`, `tail`, `wc`, `grep`, `find`, `which`, `type` |
|
|
114
|
+
| **File ops** | `mkdir`, `cp`, `mv`, `touch` |
|
|
115
|
+
| **Git** | `git status`, `git log`, `git diff`, `git branch`, `git show`, `git remote`, `git clone`, `git checkout`, `git pull`, `git fetch`, `git merge`, `git add`, `git commit`, `git push` |
|
|
116
|
+
| **Package managers** | `npm install`, `npm run`, `npm test`, `npm ci`, `npm start`, `npx`, `yarn`, `pnpm`, `pip install`, `pip3 install` |
|
|
117
|
+
| **Build & run** | `node`, `python`, `python3`, `tsc`, `go build`, `go run`, `go version`, `cargo build`, `cargo run`, `cargo test`, `make`, `rustc --version`, `java -version` |
|
|
118
|
+
|
|
119
|
+
### Exec Decision Logic
|
|
120
|
+
|
|
121
|
+
1. Matches fork bomb (regex) -> DENY (critical)
|
|
122
|
+
2. Matches dangerous command -> DENY (critical)
|
|
123
|
+
3. Matches safe command (no metacharacters, no sensitive paths) -> ALLOW (low)
|
|
124
|
+
4. Exec not allowed in capability model -> CONFIRM (non-critical) — balanced mode prompts user
|
|
125
|
+
5. Matches sensitive data access -> flag HIGH
|
|
126
|
+
6. Matches system command -> flag MEDIUM
|
|
127
|
+
7. Matches network command -> flag MEDIUM
|
|
128
|
+
8. Contains shell injection pattern -> flag MEDIUM
|
|
129
|
+
9. Sensitive env vars passed -> flag evidence
|
|
130
|
+
|
|
131
|
+
**Note**: In balanced mode, non-critical blocked commands (step 4) trigger a user prompt instead of a hard block. Only critical threats (steps 1-2) are always denied regardless of protection level.
|
|
132
|
+
|
|
133
|
+
## Default Policies
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
secret_exfil:
|
|
137
|
+
private_key: DENY (always block)
|
|
138
|
+
mnemonic: DENY (always block)
|
|
139
|
+
api_secret: CONFIRM (require user approval)
|
|
140
|
+
|
|
141
|
+
exec_command: DENY (default, unless capability allows)
|
|
142
|
+
|
|
143
|
+
web3:
|
|
144
|
+
unlimited_approval: CONFIRM
|
|
145
|
+
unknown_spender: CONFIRM
|
|
146
|
+
user_not_present: CONFIRM
|
|
147
|
+
|
|
148
|
+
network:
|
|
149
|
+
untrusted_domain: CONFIRM
|
|
150
|
+
body_contains_secret: DENY
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Capability Presets
|
|
154
|
+
|
|
155
|
+
### none (Most Restrictive)
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"network_allowlist": [],
|
|
159
|
+
"filesystem_allowlist": [],
|
|
160
|
+
"exec": "deny",
|
|
161
|
+
"secrets_allowlist": []
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### read_only
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"network_allowlist": [],
|
|
169
|
+
"filesystem_allowlist": ["./**"],
|
|
170
|
+
"exec": "deny",
|
|
171
|
+
"secrets_allowlist": []
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### trading_bot
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"network_allowlist": [
|
|
179
|
+
"api.binance.com", "api.bybit.com", "api.okx.com",
|
|
180
|
+
"api.coinbase.com", "*.dextools.io", "*.coingecko.com"
|
|
181
|
+
],
|
|
182
|
+
"filesystem_allowlist": ["./config/**", "./logs/**"],
|
|
183
|
+
"exec": "deny",
|
|
184
|
+
"secrets_allowlist": ["*_API_KEY", "*_API_SECRET"],
|
|
185
|
+
"web3": {
|
|
186
|
+
"chains_allowlist": [1, 56, 137, 42161],
|
|
187
|
+
"rpc_allowlist": ["*"],
|
|
188
|
+
"tx_policy": "confirm_high_risk"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### defi
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"network_allowlist": ["*"],
|
|
197
|
+
"filesystem_allowlist": [],
|
|
198
|
+
"exec": "deny",
|
|
199
|
+
"secrets_allowlist": [],
|
|
200
|
+
"web3": {
|
|
201
|
+
"chains_allowlist": [1, 56, 137, 42161, 10, 8453, 43114],
|
|
202
|
+
"rpc_allowlist": ["*"],
|
|
203
|
+
"tx_policy": "confirm_high_risk"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## GoPlus Integration
|
|
209
|
+
|
|
210
|
+
The `action-cli.ts decide` command integrates with the [GoPlus Security API](https://docs.gopluslabs.io/) for enhanced Web3 action evaluation. GoPlus provides three checks:
|
|
211
|
+
|
|
212
|
+
| Check | Description | Triggers |
|
|
213
|
+
|-------|-------------|----------|
|
|
214
|
+
| **Phishing Site Detection** | Checks if the transaction origin URL is a known phishing site | `PHISHING_ORIGIN` → DENY (critical) |
|
|
215
|
+
| **Address Security** | Checks if the target address is blacklisted, associated with phishing, stealing attacks, or honeypots | `MALICIOUS_ADDRESS` → DENY (critical), `HONEYPOT_RELATED` → flag (high) |
|
|
216
|
+
| **Transaction Simulation** | Simulates the transaction to detect balance changes, approval changes, and risk indicators | `UNLIMITED_APPROVAL` → CONFIRM (high), `SIMULATION_FAILED` → flag (medium) |
|
|
217
|
+
|
|
218
|
+
### Environment Variables
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
GOPLUS_API_KEY=your_key # Required for simulation
|
|
222
|
+
GOPLUS_API_SECRET=your_secret # Required for simulation
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Phishing site detection and address security checks work without API keys. Transaction simulation requires configured credentials.
|
|
226
|
+
|
|
227
|
+
### Degradation Strategy
|
|
228
|
+
|
|
229
|
+
When GoPlus is unavailable (no API keys, network errors, rate limiting):
|
|
230
|
+
|
|
231
|
+
1. The `SIMULATION_UNAVAILABLE` or `SIMULATION_FAILED` risk tag is set
|
|
232
|
+
2. Phishing and address checks that fail are silently skipped
|
|
233
|
+
3. The decision falls back to **policy-based rules only** (capability model, webhook detection, secret scanning)
|
|
234
|
+
4. For `web3_tx` and `web3_sign` without GoPlus, the skill should apply prompt-based rules and note the limitation in the output
|