@upx-us/shield 0.2.16-beta → 0.3.5
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/README.md +178 -53
- package/dist/index.d.ts +13 -15
- package/dist/index.js +593 -245
- package/dist/src/config.d.ts +1 -15
- package/dist/src/config.js +3 -39
- package/dist/src/counters.d.ts +14 -0
- package/dist/src/counters.js +96 -0
- package/dist/src/events/base.d.ts +0 -25
- package/dist/src/events/base.js +0 -15
- package/dist/src/events/browser/enrich.js +1 -1
- package/dist/src/events/exec/enrich.js +0 -2
- package/dist/src/events/exec/redactions.d.ts +0 -1
- package/dist/src/events/exec/redactions.js +0 -1
- package/dist/src/events/file/enrich.js +0 -3
- package/dist/src/events/generic/index.d.ts +0 -1
- package/dist/src/events/generic/index.js +0 -1
- package/dist/src/events/index.d.ts +0 -13
- package/dist/src/events/index.js +1 -13
- package/dist/src/events/message/validations.js +0 -3
- package/dist/src/events/sessions-spawn/enrich.js +0 -1
- package/dist/src/events/sessions-spawn/event.d.ts +0 -1
- package/dist/src/events/tool-result/enrich.js +0 -1
- package/dist/src/events/tool-result/redactions.js +0 -1
- package/dist/src/events/web/enrich.d.ts +0 -4
- package/dist/src/events/web/enrich.js +6 -14
- package/dist/src/events/web/redactions.js +1 -3
- package/dist/src/fetcher.d.ts +1 -0
- package/dist/src/fetcher.js +28 -19
- package/dist/src/index.js +51 -16
- package/dist/src/log.d.ts +0 -26
- package/dist/src/log.js +1 -27
- package/dist/src/redactor/base.d.ts +0 -23
- package/dist/src/redactor/base.js +0 -7
- package/dist/src/redactor/index.d.ts +0 -15
- package/dist/src/redactor/index.js +8 -27
- package/dist/src/redactor/strategies/command.js +0 -3
- package/dist/src/redactor/strategies/hostname.js +0 -1
- package/dist/src/redactor/strategies/index.d.ts +0 -5
- package/dist/src/redactor/strategies/index.js +0 -5
- package/dist/src/redactor/strategies/path.js +3 -3
- package/dist/src/redactor/strategies/secret-key.js +33 -9
- package/dist/src/redactor/vault.d.ts +0 -19
- package/dist/src/redactor/vault.js +7 -35
- package/dist/src/sender.d.ts +12 -20
- package/dist/src/sender.js +40 -36
- package/dist/src/setup.d.ts +11 -9
- package/dist/src/setup.js +33 -32
- package/dist/src/transformer.d.ts +1 -12
- package/dist/src/transformer.js +73 -48
- package/dist/src/validator.d.ts +0 -11
- package/dist/src/validator.js +19 -25
- package/dist/src/version.js +1 -2
- package/openclaw.plugin.json +10 -2
- package/package.json +8 -3
- package/dist/src/host-collector.d.ts +0 -1
- package/dist/src/host-collector.js +0 -200
- package/skills/shield/SKILL.md +0 -38
package/README.md
CHANGED
|
@@ -5,118 +5,243 @@
|
|
|
5
5
|
|
|
6
6
|
Real-time security monitoring for your OpenClaw agents — powered by the UPX Shield detection platform.
|
|
7
7
|
|
|
8
|
-
Shield
|
|
8
|
+
**Shield is a local collector.** It captures agent activity, redacts sensitive data, and forwards clean telemetry to the UPX platform at [uss.upx.com](https://uss.upx.com) — where security rules, correlation, alerting, playbooks, and case management give your team full visibility. The plugin itself stays lean and transparent; all the heavy lifting happens on the platform side.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
Your Agent → Shield (local: capture + redact) → UPX Platform (analysis, alerts, detections)
|
|
12
|
+
```
|
|
9
13
|
|
|
10
14
|
---
|
|
11
15
|
|
|
12
16
|
## Prerequisites
|
|
13
17
|
|
|
14
18
|
- **OpenClaw Gateway** installed and running (`openclaw gateway status`)
|
|
15
|
-
- An **
|
|
19
|
+
- An **Installation Key** provided by your Shield administrator (looks like: `A1B2C3D4E5F6...`)
|
|
16
20
|
|
|
17
21
|
---
|
|
18
22
|
|
|
19
|
-
##
|
|
23
|
+
## Quick Start — Suggested bot prompt
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
Copy this prompt and paste it to your AI agent. Replace `<YOUR_KEY>` with your Installation Key:
|
|
26
|
+
|
|
27
|
+
> Run `openclaw plugins install @upx-us/shield` to install the Shield plugin. Then update `~/.openclaw/openclaw.json`: add `"shield"` to `plugins.allow`, and under `plugins.entries.shield.config` set `"installationKey": "<YOUR_KEY>"`. Then run `openclaw gateway restart`. Confirm Shield is active with `openclaw shield status`.
|
|
28
|
+
|
|
29
|
+
That's it. The bot installs the plugin, configures the key, restarts the gateway, and Shield activates automatically.
|
|
24
30
|
|
|
25
31
|
---
|
|
26
32
|
|
|
27
|
-
##
|
|
33
|
+
## Manual Installation
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
### Step 1 — Install the plugin
|
|
30
36
|
|
|
31
37
|
```bash
|
|
32
|
-
|
|
38
|
+
openclaw plugins install @upx-us/shield
|
|
33
39
|
```
|
|
34
40
|
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
> OpenClaw will show a security warning about environment variable access and network calls — this is **expected** for a security monitoring plugin. Add `"shield"` to `plugins.allow` in `openclaw.json` to suppress it.
|
|
42
|
+
|
|
43
|
+
### Step 2 — Add your Installation Key
|
|
44
|
+
|
|
45
|
+
Open `~/.openclaw/openclaw.json` and add the following:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"plugins": {
|
|
50
|
+
"allow": ["shield"],
|
|
51
|
+
"entries": {
|
|
52
|
+
"shield": {
|
|
53
|
+
"config": {
|
|
54
|
+
"installationKey": "YOUR_KEY_HERE"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
37
60
|
```
|
|
38
|
-
🛡️ OpenClaw Shield Setup
|
|
39
|
-
==========================
|
|
40
61
|
|
|
41
|
-
Installation Key
|
|
62
|
+
> **Note:** Each Installation Key is single-use. The plugin exchanges it for credentials on first startup and saves them locally — you can remove `installationKey` from the config after activation.
|
|
63
|
+
|
|
64
|
+
### Step 3 — Restart the Gateway
|
|
42
65
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
✅ Shield activated!
|
|
46
|
-
Restart your OpenClaw Gateway to start monitoring.
|
|
66
|
+
```bash
|
|
67
|
+
openclaw gateway restart
|
|
47
68
|
```
|
|
48
69
|
|
|
49
|
-
|
|
70
|
+
Shield auto-registers, saves credentials to `~/.openclaw/shield/config.env`, and starts monitoring.
|
|
50
71
|
|
|
51
72
|
---
|
|
52
73
|
|
|
53
|
-
##
|
|
74
|
+
## Alternative: CLI Activation
|
|
75
|
+
|
|
76
|
+
If the config-based flow didn't work (e.g. the key was added to the wrong path), you can activate directly:
|
|
54
77
|
|
|
55
78
|
```bash
|
|
79
|
+
openclaw shield activate <YOUR_KEY>
|
|
56
80
|
openclaw gateway restart
|
|
57
81
|
```
|
|
58
82
|
|
|
59
83
|
---
|
|
60
84
|
|
|
61
|
-
##
|
|
85
|
+
## Verify it's running
|
|
62
86
|
|
|
63
87
|
```bash
|
|
64
88
|
openclaw shield status
|
|
65
89
|
```
|
|
66
90
|
|
|
67
|
-
|
|
91
|
+
**When activated:**
|
|
68
92
|
|
|
69
93
|
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
94
|
+
OpenClaw Shield — v0.3.0 (5s ago)
|
|
95
|
+
|
|
96
|
+
── Plugin Health ─────────────────────────────
|
|
97
|
+
Connection: ✅ Connected
|
|
98
|
+
Version: 0.3.0
|
|
99
|
+
Instance: a1b2c3d4…
|
|
100
|
+
Last poll: 5s ago
|
|
101
|
+
Events sent: 1,842 (all-time)
|
|
102
|
+
Quarantine: 0 (all-time)
|
|
103
|
+
Failures: 0 (consecutive)
|
|
104
|
+
Daemon PID: 12345
|
|
105
|
+
Session: 4h 12m
|
|
106
|
+
|
|
107
|
+
── Activity ──────────────────────────────────
|
|
108
|
+
|
|
109
|
+
📡 Last sync (29s ago — 5 events)
|
|
110
|
+
TOOL_RESULT ████████ 3
|
|
111
|
+
TOOL_CALL █████ 2
|
|
112
|
+
|
|
113
|
+
📊 This session (since restart 4h 12m ago — 142 events)
|
|
114
|
+
TOOL_CALL ████████ 78
|
|
115
|
+
TOOL_RESULT ███████ 64
|
|
116
|
+
|
|
117
|
+
🔒 Redactions (10x this session)
|
|
118
|
+
hostname data redacted 5x
|
|
119
|
+
username data redacted 5x
|
|
120
|
+
(original values stored encrypted locally — never transmitted)
|
|
77
121
|
```
|
|
78
122
|
|
|
79
|
-
|
|
123
|
+
**When not activated:**
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
OpenClaw Shield — v0.3.0
|
|
127
|
+
|
|
128
|
+
Status: Loaded (not activated)
|
|
129
|
+
|
|
130
|
+
To activate, provide your Installation Key:
|
|
131
|
+
1. openclaw shield activate <YOUR_KEY>
|
|
132
|
+
2. Add to openclaw.json:
|
|
133
|
+
plugins.entries.shield.config.installationKey = "<YOUR_KEY>"
|
|
134
|
+
Then: openclaw gateway restart
|
|
135
|
+
|
|
136
|
+
Get your key at: https://uss.upx.com → APPS → OpenClaw Shield
|
|
137
|
+
```
|
|
80
138
|
|
|
81
139
|
---
|
|
82
140
|
|
|
83
|
-
##
|
|
141
|
+
## Understanding the status output
|
|
142
|
+
|
|
143
|
+
### Event types
|
|
84
144
|
|
|
85
|
-
Shield captures
|
|
145
|
+
Shield captures what your agent *does* — not what it says. Each line in the Activity section represents a category of tool calls:
|
|
86
146
|
|
|
87
|
-
| Event type |
|
|
147
|
+
| Event type | What it means |
|
|
88
148
|
|---|---|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
149
|
+
| `TOOL_CALL` | A tool was invoked by the agent (exec, read, write, web search, etc.) |
|
|
150
|
+
| `TOOL_RESULT` | The result returned from a tool call |
|
|
151
|
+
| `exec` | Shell command executed |
|
|
152
|
+
| `file` | File read, written, or edited |
|
|
153
|
+
| `web` | URL fetched, web search, or browser action |
|
|
154
|
+
| `message` | Message sent via a channel (Telegram, WhatsApp, etc.) |
|
|
155
|
+
| `sessions_spawn` | A sub-agent was launched |
|
|
156
|
+
| `browser` | Browser automation action |
|
|
157
|
+
| `cron` | A scheduled task fired |
|
|
158
|
+
|
|
159
|
+
Shield captures what your agent *does* — tool invocations and their results. Each event carries metadata about the operation (tool name, paths, URLs) along with a redacted summary of the result.
|
|
160
|
+
|
|
161
|
+
### Quarantine
|
|
162
|
+
|
|
163
|
+
Quarantine counts events that failed local schema validation and were **held back** rather than forwarded to the platform. They are not lost — they're written to `~/.openclaw/shield/data/quarantine.jsonl` for inspection. A non-zero quarantine count usually means a plugin version mismatch between the collector and the platform schema; upgrading Shield typically resolves it.
|
|
94
164
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
-
|
|
98
|
-
|
|
165
|
+
### Redactions
|
|
166
|
+
|
|
167
|
+
Redaction runs locally before anything leaves your machine. The counts shown are **occurrences** — how many times that category of sensitive data was detected and replaced with a reversible token (e.g. `host:a3f9b1c2`, `user:7b2c4a1f`). The original values are stored in an encrypted local vault (`~/.openclaw/shield/data/redaction-vault.json`) so they can be recovered for investigation — they are never transmitted to the platform.
|
|
168
|
+
|
|
169
|
+
### All-time vs. session
|
|
170
|
+
|
|
171
|
+
- **Events sent / Quarantine** in the health section = all-time totals, persisted across gateway restarts
|
|
172
|
+
- **This session** in the activity section = since the last gateway restart
|
|
173
|
+
- **Last sync** = the most recent poll cycle only
|
|
174
|
+
|
|
175
|
+
To see the full picture — detections, alerts, rules, and cases — visit [uss.upx.com](https://uss.upx.com).
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## What data is collected
|
|
180
|
+
|
|
181
|
+
Shield captures agent activity locally, applies on-device redaction, and forwards telemetry to the UPX platform.
|
|
182
|
+
|
|
183
|
+
| Data type | Captured | Redacted on-device before transmission |
|
|
184
|
+
|---|---|---|
|
|
185
|
+
| Tool name | ✅ | — |
|
|
186
|
+
| Command strings | ✅ | ✅ secrets, paths replaced with tokens |
|
|
187
|
+
| File paths | ✅ | ✅ username segment replaced with token |
|
|
188
|
+
| Tool result output | ✅ | ✅ truncated and redacted |
|
|
189
|
+
| Hostname | ✅ | ✅ replaced with token |
|
|
190
|
+
| Username | ✅ | ✅ replaced with token |
|
|
191
|
+
| URLs | ✅ | — |
|
|
192
|
+
| API keys detected in commands | ✅ | ✅ replaced with token |
|
|
193
|
+
|
|
194
|
+
> **How redaction works:** sensitive values are replaced with deterministic `category:hash` tokens (e.g. `host:a3f9b1c2`, `user:7b2c4a1f`) before leaving your machine. The mapping from token → original value is stored in an encrypted local vault (`~/.openclaw/shield/data/redaction-vault.json`, AES-256-GCM) so your team can reverse-lookup locally if needed. Original values are never transmitted to the platform.
|
|
99
195
|
|
|
100
196
|
---
|
|
101
197
|
|
|
102
198
|
## How your data is protected
|
|
103
199
|
|
|
104
|
-
**Redaction** runs locally before any data leaves your machine. The redactor
|
|
200
|
+
**Redaction** runs locally before any data leaves your machine. The redactor detects hostnames, usernames, file paths, API keys, and secrets — replacing them with deterministic `category:hash` tokens. The token→original mapping is stored in an AES-256-GCM encrypted vault (`~/.openclaw/shield/data/redaction-vault.json`, mode 0600). Original values are never transmitted.
|
|
105
201
|
|
|
106
|
-
**
|
|
202
|
+
**Authentication** uses HMAC-SHA256 with a per-instance signing key. Every request is signed — requests with invalid signatures are rejected by the platform.
|
|
107
203
|
|
|
108
|
-
**Credentials** are stored locally at `~/.openclaw/shield/config.env` (mode 0600
|
|
204
|
+
**Credentials** are stored locally at `~/.openclaw/shield/config.env` (mode 0600) and are never transmitted.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Upgrading
|
|
209
|
+
|
|
210
|
+
- Standard upgrade command: `openclaw plugins update shield`
|
|
211
|
+
- Cursors and credentials are preserved across upgrades
|
|
212
|
+
- After upgrade verify with: `openclaw shield status`
|
|
213
|
+
- See CHANGELOG.md for version history
|
|
109
214
|
|
|
110
215
|
---
|
|
111
216
|
|
|
112
217
|
## Troubleshooting
|
|
113
218
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
219
|
+
**Shield shows "not activated"**
|
|
220
|
+
→ Get your Installation Key at [uss.upx.com](https://uss.upx.com) → APPS → OpenClaw Shield → Install
|
|
221
|
+
→ Add to `openclaw.json`:
|
|
222
|
+
```json
|
|
223
|
+
"plugins": { "entries": { "shield": { "config": { "installationKey": "YOUR_KEY" } } } }
|
|
224
|
+
```
|
|
225
|
+
→ Restart OpenClaw
|
|
226
|
+
|
|
227
|
+
**Activated but no events reaching platform**
|
|
228
|
+
→ Run `openclaw shield status` — check Failures count and Last sync time
|
|
229
|
+
→ Verify network access to the Shield API endpoint (check your config for the URL)
|
|
230
|
+
→ Enable debug logging: set `LOG_LEVEL=debug` in your environment
|
|
231
|
+
|
|
232
|
+
**High CPU or memory usage**
|
|
233
|
+
→ Increase poll interval in config: `"pollIntervalMs": 60000` (default is 30000ms)
|
|
234
|
+
→ Shield processes at most 5000 events per poll cycle regardless of backlog size
|
|
235
|
+
|
|
236
|
+
**Cursor file issues**
|
|
237
|
+
→ Cursor file location: `~/.openclaw/shield/data/cursors.json`
|
|
238
|
+
→ To reset: delete the file — Shield will reinitialize on next poll (some events may re-process)
|
|
239
|
+
|
|
240
|
+
**Enable debug logging**
|
|
241
|
+
→ `LOG_LEVEL=debug openclaw start` — verbose output including poll cycles and send results
|
|
242
|
+
|
|
243
|
+
**Dry-run mode (no events sent)**
|
|
244
|
+
→ Add `"dryRun": true` to plugin config — events are processed and logged but never transmitted
|
|
120
245
|
|
|
121
246
|
---
|
|
122
247
|
|
|
@@ -126,10 +251,10 @@ Shield does **not** collect:
|
|
|
126
251
|
openclaw plugins uninstall shield
|
|
127
252
|
```
|
|
128
253
|
|
|
129
|
-
Stops the monitoring bridge and removes the plugin.
|
|
254
|
+
Stops the monitoring bridge and removes the plugin.
|
|
130
255
|
|
|
131
256
|
---
|
|
132
257
|
|
|
133
258
|
## Need help?
|
|
134
259
|
|
|
135
|
-
|
|
260
|
+
Visit the Shield portal at [uss.upx.com](https://uss.upx.com) or contact your Shield administrator. For UPX support, reach out at [upx.com](https://upx.com).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* - Plugin mode: this file, registered via api.registerService()
|
|
14
|
-
* - Standalone mode: src/index.ts, runs directly via `shield-bridge`
|
|
15
|
-
*/
|
|
1
|
+
import { ShieldCredentials } from './src/config';
|
|
2
|
+
export declare function performAutoRegistration(installationKey: string): Promise<ShieldCredentials | null>;
|
|
3
|
+
export declare function resolveInstallationKey(pluginConfig: Record<string, unknown>): string | null;
|
|
4
|
+
export declare function maskPluginConfigForLogs(pluginConfig: Record<string, unknown>): Record<string, unknown>;
|
|
5
|
+
export declare function createSingleflightRunner(task: () => Promise<void>): () => Promise<void>;
|
|
6
|
+
interface StartGuard {
|
|
7
|
+
begin: () => boolean;
|
|
8
|
+
endSuccess: () => void;
|
|
9
|
+
endFailure: () => void;
|
|
10
|
+
reset: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createStartGuard(): StartGuard;
|
|
16
13
|
interface OpenClawPluginAPI {
|
|
17
14
|
config?: Record<string, unknown>;
|
|
15
|
+
pluginConfig?: Record<string, unknown>;
|
|
18
16
|
logger: {
|
|
19
17
|
info(msg: string): void;
|
|
20
18
|
warn(msg: string): void;
|