@upx-us/shield 0.3.4 → 0.3.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/README.md +2 -0
- package/dist/src/index.js +33 -10
- package/dist/src/transformer.d.ts +1 -0
- package/dist/src/transformer.js +4 -0
- package/openclaw.plugin.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -212,6 +212,8 @@ Shield captures agent activity locally, applies on-device redaction, and forward
|
|
|
212
212
|
- After upgrade verify with: `openclaw shield status`
|
|
213
213
|
- See CHANGELOG.md for version history
|
|
214
214
|
|
|
215
|
+
> **"Integrity drift detected"** during upgrade is expected. OpenClaw stores the checksum of the installed version and warns when it changes — which it always does on a legitimate upgrade. Confirm with `y` to proceed. This prompt only indicates a real problem if you see it without having explicitly upgraded (e.g. the plugin files changed unexpectedly).
|
|
216
|
+
|
|
215
217
|
---
|
|
216
218
|
|
|
217
219
|
## Troubleshooting
|
package/dist/src/index.js
CHANGED
|
@@ -45,8 +45,10 @@ const version_1 = require("./version");
|
|
|
45
45
|
let running = true;
|
|
46
46
|
let lastTelemetryAt = 0;
|
|
47
47
|
let consecutiveFailures = 0;
|
|
48
|
+
let registrationOk = false;
|
|
48
49
|
const TELEMETRY_INTERVAL_MS = 5 * 60 * 1000;
|
|
49
50
|
const MAX_BACKOFF_MS = 5 * 60 * 1000;
|
|
51
|
+
const MAX_REGISTRATION_FAILURES = 10;
|
|
50
52
|
function getBackoffInterval(baseMs) {
|
|
51
53
|
if (consecutiveFailures === 0)
|
|
52
54
|
return baseMs;
|
|
@@ -66,17 +68,20 @@ async function poll() {
|
|
|
66
68
|
if (now - lastTelemetryAt >= TELEMETRY_INTERVAL_MS) {
|
|
67
69
|
const hostSnapshot = config.collectHostMetrics ? (0, transformer_1.generateHostTelemetry)() : null;
|
|
68
70
|
const hostMeta = hostSnapshot?.event?.tool_metadata;
|
|
71
|
+
const agentId = process.env.OPENCLAW_AGENT_ID || 'main';
|
|
69
72
|
const instancePayload = {
|
|
70
73
|
machine: {
|
|
71
74
|
hostname: config.hostname,
|
|
72
75
|
os: process.platform,
|
|
73
76
|
arch: process.arch,
|
|
74
77
|
node_version: process.version,
|
|
78
|
+
public_ip: (0, transformer_1.getCachedPublicIp)() ?? undefined,
|
|
75
79
|
},
|
|
76
80
|
software: {
|
|
77
81
|
plugin_version: version_1.VERSION,
|
|
78
82
|
openclaw_version: (0, transformer_1.resolveOpenClawVersion)(),
|
|
79
|
-
agent_label: (0, transformer_1.resolveAgentLabel)(
|
|
83
|
+
agent_label: (0, transformer_1.resolveAgentLabel)(agentId),
|
|
84
|
+
instance_name: (0, transformer_1.resolveAgentLabel)(agentId) || config.hostname,
|
|
80
85
|
...(hostMeta && {
|
|
81
86
|
gateway_bind: hostMeta['openclaw.gateway_bind'],
|
|
82
87
|
webhook_configured: hostMeta['openclaw.webhook_configured'],
|
|
@@ -86,16 +91,27 @@ async function poll() {
|
|
|
86
91
|
};
|
|
87
92
|
const result = await (0, sender_1.reportInstance)(instancePayload, config.credentials);
|
|
88
93
|
log.info('bridge', `Instance report → Platform: success=${result.ok}`);
|
|
89
|
-
if (result.ok
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
if (result.ok) {
|
|
95
|
+
registrationOk = true;
|
|
96
|
+
lastTelemetryAt = now;
|
|
97
|
+
if (result.score) {
|
|
98
|
+
log.info('bridge', `Protection score: ${result.score.badge} ${result.score.total}/100 (${result.score.grade})`);
|
|
99
|
+
if (result.score.recommendations?.length) {
|
|
100
|
+
for (const rec of result.score.recommendations) {
|
|
101
|
+
log.warn('bridge', `⚠ ${rec}`);
|
|
102
|
+
}
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
105
|
}
|
|
97
|
-
if (
|
|
98
|
-
|
|
106
|
+
else if (!registrationOk) {
|
|
107
|
+
consecutiveFailures++;
|
|
108
|
+
if (consecutiveFailures >= MAX_REGISTRATION_FAILURES) {
|
|
109
|
+
log.error('bridge', `reportInstance failed ${consecutiveFailures} consecutive times — instance not recognized. Re-run setup wizard. Exiting.`);
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
log.warn('bridge', `reportInstance failed (attempt ${consecutiveFailures}/${MAX_REGISTRATION_FAILURES}) — skipping events this cycle (platform may still be syncing)`);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
99
115
|
}
|
|
100
116
|
if (entries.length > 0) {
|
|
101
117
|
let envelopes = (0, transformer_1.transformEntries)(entries);
|
|
@@ -126,8 +142,15 @@ async function poll() {
|
|
|
126
142
|
}
|
|
127
143
|
}
|
|
128
144
|
if (results.some(r => r.needsRegistration)) {
|
|
129
|
-
|
|
130
|
-
|
|
145
|
+
consecutiveFailures++;
|
|
146
|
+
registrationOk = false;
|
|
147
|
+
lastTelemetryAt = 0;
|
|
148
|
+
if (consecutiveFailures >= MAX_REGISTRATION_FAILURES) {
|
|
149
|
+
log.error('bridge', `Instance not recognized by platform after ${consecutiveFailures} attempts. Re-run the setup wizard. Exiting.`);
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
log.warn('bridge', `Instance not registered on platform (attempt ${consecutiveFailures}/${MAX_REGISTRATION_FAILURES}) — will re-register on next cycle`);
|
|
153
|
+
continue;
|
|
131
154
|
}
|
|
132
155
|
const pendingResult = results.find(r => r.pendingNamespace);
|
|
133
156
|
if (pendingResult) {
|
|
@@ -10,6 +10,7 @@ export interface IngestPayload {
|
|
|
10
10
|
}
|
|
11
11
|
export declare function resolveOpenClawVersion(): string;
|
|
12
12
|
export declare function resolveAgentLabel(agentId: string): string;
|
|
13
|
+
export declare function getCachedPublicIp(): string | null;
|
|
13
14
|
export declare function resolveOutboundIp(): Promise<string | null>;
|
|
14
15
|
export declare function transformEntries(entries: RawEntry[]): EnvelopeEvent[];
|
|
15
16
|
export declare function generateHostTelemetry(): EnvelopeEvent | null;
|
package/dist/src/transformer.js
CHANGED
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.resolveOpenClawVersion = resolveOpenClawVersion;
|
|
37
37
|
exports.resolveAgentLabel = resolveAgentLabel;
|
|
38
|
+
exports.getCachedPublicIp = getCachedPublicIp;
|
|
38
39
|
exports.resolveOutboundIp = resolveOutboundIp;
|
|
39
40
|
exports.transformEntries = transformEntries;
|
|
40
41
|
exports.generateHostTelemetry = generateHostTelemetry;
|
|
@@ -116,6 +117,9 @@ function writeIpCache(ip) {
|
|
|
116
117
|
}
|
|
117
118
|
catch { }
|
|
118
119
|
}
|
|
120
|
+
function getCachedPublicIp() {
|
|
121
|
+
return readIpCache()?.ip ?? (_source?.ip_addresses[0] ?? null);
|
|
122
|
+
}
|
|
119
123
|
function resolveOutboundIp() {
|
|
120
124
|
return new Promise((resolve) => {
|
|
121
125
|
try {
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "shield",
|
|
3
3
|
"name": "OpenClaw Shield",
|
|
4
4
|
"description": "Real-time security monitoring \u2014 streams enriched, redacted security events to the Shield detection platform.",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.6",
|
|
6
6
|
"skills": [
|
|
7
7
|
"./skills"
|
|
8
8
|
],
|
|
@@ -57,4 +57,4 @@
|
|
|
57
57
|
"label": "Collect host telemetry metrics"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
}
|
|
60
|
+
}
|
package/package.json
CHANGED