@upx-us/shield 0.7.5 → 0.7.7
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/CHANGELOG.md +16 -0
- package/dist/src/config.js +4 -11
- package/dist/src/index.js +3 -2
- package/dist/src/rpc/client.js +2 -3
- package/dist/src/transformer.d.ts +1 -0
- package/dist/src/transformer.js +38 -22
- package/dist/src/updater.js +9 -0
- package/dist/src/version.d.ts +1 -0
- package/dist/src/version.js +13 -0
- package/openclaw.plugin.json +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [0.7.7] — 2026-03-16
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Bug preventing the plugin from starting after an auto-update** (#177): In certain conditions following an auto-update, the plugin would crash on every boot before processing any events. A gateway restart is sufficient to recover affected instances.
|
|
12
|
+
- **Bug causing incorrect plugin version to be reported in the dashboard** (#175): Some instances were reporting a stale version number in the platform dashboard instead of the currently installed version.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## [0.7.6] — 2026-03-13
|
|
17
|
+
|
|
18
|
+
### Security
|
|
19
|
+
- **URL enforcement switched to allowlist** — plugin traffic is restricted to the Shield ingest endpoint. Any other URL is rejected and replaced with the default. No infrastructure details are disclosed in source.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
7
23
|
## [0.7.5] — 2026-03-13
|
|
8
24
|
|
|
9
25
|
### Security
|
package/dist/src/config.js
CHANGED
|
@@ -139,18 +139,11 @@ function loadCredentials() {
|
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
const CANONICAL_INGEST_URL = 'https://openclaw-shield.upx.com';
|
|
142
|
-
const BLOCKED_HOST_PATTERNS = [
|
|
143
|
-
/^https?:\/\/uss\.upx\.com/i,
|
|
144
|
-
/^https?:\/\/[a-z0-9-]+\.replit\.app/i,
|
|
145
|
-
/^https?:\/\/egupx-/i,
|
|
146
|
-
];
|
|
147
142
|
function enforceIngestUrl(url) {
|
|
148
|
-
if (!url)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
log.warn('config', `SHIELD_API_URL points to a platform backend ("${url}") — this is not permitted. ` +
|
|
153
|
-
`Overriding with ${CANONICAL_INGEST_URL}. Remove SHIELD_API_URL from your config to fix this permanently.`);
|
|
143
|
+
if (!url || !url.startsWith(CANONICAL_INGEST_URL)) {
|
|
144
|
+
if (url && url !== CANONICAL_INGEST_URL) {
|
|
145
|
+
log.warn('config', `SHIELD_API_URL is not a permitted ingest endpoint — overriding with the default. Remove SHIELD_API_URL from your config to fix this permanently.`);
|
|
146
|
+
}
|
|
154
147
|
return CANONICAL_INGEST_URL;
|
|
155
148
|
}
|
|
156
149
|
return url;
|
package/dist/src/index.js
CHANGED
|
@@ -85,7 +85,8 @@ async function poll() {
|
|
|
85
85
|
const _rawEnvStartup = process.env.SHIELD_AUTO_UPDATE;
|
|
86
86
|
const autoUpdateMode = _rawEnvStartup === 'false' ? false : _rawEnvStartup ?? true;
|
|
87
87
|
log.info('updater', `Startup update check (autoUpdate=${autoUpdateMode}, current=${version_1.VERSION})`);
|
|
88
|
-
const
|
|
88
|
+
const _bootState = (0, updater_1.loadUpdateState)();
|
|
89
|
+
const startupUpdate = (0, updater_1.performAutoUpdate)(autoUpdateMode, _bootState.pendingRestart ? undefined : 0);
|
|
89
90
|
if (startupUpdate.action === "none") {
|
|
90
91
|
log.info("updater", `Up to date (${version_1.VERSION})`);
|
|
91
92
|
}
|
|
@@ -119,7 +120,7 @@ async function poll() {
|
|
|
119
120
|
public_ip: (0, transformer_1.getCachedPublicIp)() ?? '',
|
|
120
121
|
},
|
|
121
122
|
software: {
|
|
122
|
-
plugin_version: version_1.
|
|
123
|
+
plugin_version: (0, version_1.getVersion)(),
|
|
123
124
|
openclaw_version: (0, transformer_1.resolveOpenClawVersion)(),
|
|
124
125
|
agent_label: (0, transformer_1.resolveAgentLabel)(agentId),
|
|
125
126
|
instance_name: (0, transformer_1.resolveAgentLabel)(agentId) || config.hostname,
|
package/dist/src/rpc/client.js
CHANGED
|
@@ -57,11 +57,10 @@ async function callPlatformApi(config, path, params, method) {
|
|
|
57
57
|
error: 'Platform API not configured. This feature requires the Shield platform API which is not yet available for your instance. Check your Shield dashboard for updates.',
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
if (BLOCKED.some(p => p.test(config.apiUrl))) {
|
|
60
|
+
if (!config.apiUrl.startsWith('https://openclaw-shield.upx.com')) {
|
|
62
61
|
return {
|
|
63
62
|
ok: false,
|
|
64
|
-
error: 'Shield API URL
|
|
63
|
+
error: 'Shield API URL is not the permitted ingest endpoint. Reconfigure Shield or contact support.',
|
|
65
64
|
};
|
|
66
65
|
}
|
|
67
66
|
const url = new URL(path, config.apiUrl);
|
|
@@ -11,6 +11,7 @@ export interface IngestPayload {
|
|
|
11
11
|
export declare function normalizeSoftwareVersion(v: string): string;
|
|
12
12
|
export declare function resolveOpenClawVersion(): string;
|
|
13
13
|
export declare function _resetCachedOpenClawVersion(): void;
|
|
14
|
+
export declare function _setVersionForTest(version: string, fromStaleFallback: boolean): void;
|
|
14
15
|
export declare function resolveAgentLabel(agentId: string): string;
|
|
15
16
|
export declare function getCachedPublicIp(): string | null;
|
|
16
17
|
export declare function isPrivateIp(ip: string): boolean;
|
package/dist/src/transformer.js
CHANGED
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.normalizeSoftwareVersion = normalizeSoftwareVersion;
|
|
37
37
|
exports.resolveOpenClawVersion = resolveOpenClawVersion;
|
|
38
38
|
exports._resetCachedOpenClawVersion = _resetCachedOpenClawVersion;
|
|
39
|
+
exports._setVersionForTest = _setVersionForTest;
|
|
39
40
|
exports.resolveAgentLabel = resolveAgentLabel;
|
|
40
41
|
exports.getCachedPublicIp = getCachedPublicIp;
|
|
41
42
|
exports.isPrivateIp = isPrivateIp;
|
|
@@ -54,6 +55,7 @@ const counters_1 = require("./counters");
|
|
|
54
55
|
const inventory_1 = require("./inventory");
|
|
55
56
|
const attributor_1 = require("./attributor");
|
|
56
57
|
let _cachedOpenClawVersion = "";
|
|
58
|
+
let _cachedFromStaleFallback = false;
|
|
57
59
|
function normalizeSoftwareVersion(v) {
|
|
58
60
|
return v
|
|
59
61
|
.replace(/^openclaw\s+/i, '')
|
|
@@ -62,10 +64,11 @@ function normalizeSoftwareVersion(v) {
|
|
|
62
64
|
.trim();
|
|
63
65
|
}
|
|
64
66
|
function resolveOpenClawVersion() {
|
|
65
|
-
if (_cachedOpenClawVersion !== "")
|
|
67
|
+
if (_cachedOpenClawVersion !== "" && !_cachedFromStaleFallback)
|
|
66
68
|
return _cachedOpenClawVersion;
|
|
67
69
|
if (process.env.OPENCLAW_VERSION) {
|
|
68
70
|
_cachedOpenClawVersion = process.env.OPENCLAW_VERSION;
|
|
71
|
+
_cachedFromStaleFallback = false;
|
|
69
72
|
return _cachedOpenClawVersion;
|
|
70
73
|
}
|
|
71
74
|
try {
|
|
@@ -73,6 +76,7 @@ function resolveOpenClawVersion() {
|
|
|
73
76
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
74
77
|
if (pkg.version) {
|
|
75
78
|
_cachedOpenClawVersion = normalizeSoftwareVersion(pkg.version);
|
|
79
|
+
_cachedFromStaleFallback = false;
|
|
76
80
|
return _cachedOpenClawVersion;
|
|
77
81
|
}
|
|
78
82
|
}
|
|
@@ -88,6 +92,7 @@ function resolveOpenClawVersion() {
|
|
|
88
92
|
const version = normalizeSoftwareVersion(raw);
|
|
89
93
|
if (version && version !== 'unknown') {
|
|
90
94
|
_cachedOpenClawVersion = version;
|
|
95
|
+
_cachedFromStaleFallback = false;
|
|
91
96
|
return _cachedOpenClawVersion;
|
|
92
97
|
}
|
|
93
98
|
}
|
|
@@ -99,16 +104,23 @@ function resolveOpenClawVersion() {
|
|
|
99
104
|
const normalized = normalizeSoftwareVersion(v);
|
|
100
105
|
if (normalized) {
|
|
101
106
|
_cachedOpenClawVersion = normalized;
|
|
107
|
+
_cachedFromStaleFallback = true;
|
|
102
108
|
return _cachedOpenClawVersion;
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
catch { }
|
|
107
113
|
_cachedOpenClawVersion = 'unknown';
|
|
114
|
+
_cachedFromStaleFallback = false;
|
|
108
115
|
return _cachedOpenClawVersion;
|
|
109
116
|
}
|
|
110
117
|
function _resetCachedOpenClawVersion() {
|
|
111
118
|
_cachedOpenClawVersion = "";
|
|
119
|
+
_cachedFromStaleFallback = false;
|
|
120
|
+
}
|
|
121
|
+
function _setVersionForTest(version, fromStaleFallback) {
|
|
122
|
+
_cachedOpenClawVersion = version;
|
|
123
|
+
_cachedFromStaleFallback = fromStaleFallback;
|
|
112
124
|
}
|
|
113
125
|
function resolveAgentLabel(agentId) {
|
|
114
126
|
if (process.env.OPENCLAW_AGENT_LABEL)
|
|
@@ -217,28 +229,32 @@ function injectIp(ip) {
|
|
|
217
229
|
}
|
|
218
230
|
initOutboundIp();
|
|
219
231
|
function getSourceInfo() {
|
|
220
|
-
if (_source)
|
|
221
|
-
return _source;
|
|
222
232
|
const agentId = process.env.OPENCLAW_AGENT_ID || 'main';
|
|
223
|
-
_source
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
233
|
+
if (!_source) {
|
|
234
|
+
_source = {
|
|
235
|
+
hostname: os.hostname(),
|
|
236
|
+
ip_addresses: Object.values(os.networkInterfaces())
|
|
237
|
+
.flat()
|
|
238
|
+
.filter((i) => i && i.family === 'IPv4' && !i.internal)
|
|
239
|
+
.map((i) => i.address),
|
|
240
|
+
os: {
|
|
241
|
+
type: os.type(),
|
|
242
|
+
platform: os.platform() === 'darwin' ? 'MAC' : os.platform() === 'linux' ? 'LINUX' : 'WINDOWS',
|
|
243
|
+
release: os.release(),
|
|
244
|
+
arch: os.arch(),
|
|
245
|
+
},
|
|
246
|
+
openclaw: {
|
|
247
|
+
version: resolveOpenClawVersion(),
|
|
248
|
+
agent_id: agentId,
|
|
249
|
+
agent_label: resolveAgentLabel(agentId),
|
|
250
|
+
},
|
|
251
|
+
plugin: { version: version_1.VERSION, transport: 'openclaw_plugin' },
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
_source.openclaw.version = resolveOpenClawVersion();
|
|
256
|
+
_source.plugin.version = (0, version_1.getVersion)();
|
|
257
|
+
}
|
|
242
258
|
return _source;
|
|
243
259
|
}
|
|
244
260
|
function isAdministrativeEvent(toolName, args, sessionId) {
|
package/dist/src/updater.js
CHANGED
|
@@ -459,6 +459,15 @@ function downloadAndInstall(targetVersion) {
|
|
|
459
459
|
}
|
|
460
460
|
function performAutoUpdate(mode, checkIntervalMs) {
|
|
461
461
|
const noOp = { action: 'none', fromVersion: version_1.VERSION, toVersion: null, message: '', requiresRestart: false };
|
|
462
|
+
{
|
|
463
|
+
const st = loadUpdateState();
|
|
464
|
+
if (st.pendingRestart && st.currentVersion === version_1.VERSION) {
|
|
465
|
+
log.info('updater', `Clearing stale pendingRestart — running version matches stored currentVersion (${version_1.VERSION})`);
|
|
466
|
+
st.pendingRestart = false;
|
|
467
|
+
st.restartAttempts = 0;
|
|
468
|
+
saveUpdateState(st);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
462
471
|
if (mode === false)
|
|
463
472
|
return noOp;
|
|
464
473
|
{
|
package/dist/src/version.d.ts
CHANGED
package/dist/src/version.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
|
+
exports.getVersion = getVersion;
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
function loadVersion() {
|
|
@@ -16,3 +17,15 @@ function loadVersion() {
|
|
|
16
17
|
return '0.0.0';
|
|
17
18
|
}
|
|
18
19
|
exports.VERSION = loadVersion();
|
|
20
|
+
function getVersion() {
|
|
21
|
+
for (const rel of ['../package.json', '../../package.json']) {
|
|
22
|
+
const p = (0, path_1.join)(__dirname, rel);
|
|
23
|
+
if ((0, fs_1.existsSync)(p)) {
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse((0, fs_1.readFileSync)(p, 'utf-8')).version ?? '0.0.0';
|
|
26
|
+
}
|
|
27
|
+
catch { }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return '0.0.0';
|
|
31
|
+
}
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "shield",
|
|
3
3
|
"name": "OpenClaw Shield",
|
|
4
|
-
"description": "Real-time security monitoring
|
|
5
|
-
"version": "0.7.
|
|
4
|
+
"description": "Real-time security monitoring — streams enriched, redacted security events to the Shield detection platform.",
|
|
5
|
+
"version": "0.7.7",
|
|
6
6
|
"skills": [
|
|
7
7
|
"./skills"
|
|
8
8
|
],
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"uiHints": {
|
|
55
55
|
"installationKey": {
|
|
56
56
|
"label": "Installation Key",
|
|
57
|
-
"description": "One-time key from your trial signup at https://www.upx.com/en/lp/openclaw-shield-upx
|
|
57
|
+
"description": "One-time key from your trial signup at https://www.upx.com/en/lp/openclaw-shield-upx — Required for first-time activation only. After activation, log in at https://uss.upx.com"
|
|
58
58
|
},
|
|
59
59
|
"enabled": {
|
|
60
60
|
"label": "Enable security monitoring"
|
package/package.json
CHANGED