@upx-us/shield 0.2.13-beta → 0.2.15-beta
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.
Potentially problematic release.
This version of @upx-us/shield might be problematic. Click here for more details.
- package/dist/index.js +5 -0
- package/dist/src/index.js +6 -0
- package/dist/src/sender.js +6 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -261,6 +261,11 @@ exports.default = {
|
|
|
261
261
|
try {
|
|
262
262
|
const entries = await fetchNewEntries(config);
|
|
263
263
|
if (entries.length === 0) {
|
|
264
|
+
// Still commit cursors so initCursorsForDir positions
|
|
265
|
+
// (set to current file sizes) are persisted on disk.
|
|
266
|
+
// Without this, each poll re-initialises cursors to the
|
|
267
|
+
// NEW file size and silently skips events between polls.
|
|
268
|
+
commitCursors(config, []);
|
|
264
269
|
state.consecutiveFailures = 0;
|
|
265
270
|
state.lastPollAt = Date.now();
|
|
266
271
|
persistState();
|
package/dist/src/index.js
CHANGED
|
@@ -134,6 +134,12 @@ async function poll() {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
else {
|
|
137
|
+
// No new entries this poll — but still commit cursors so that
|
|
138
|
+
// initCursorsForDir positions (set to current file sizes) are
|
|
139
|
+
// persisted. Without this, the next poll re-initialises cursors
|
|
140
|
+
// to the NEW current size and silently skips any events that
|
|
141
|
+
// arrived between polls.
|
|
142
|
+
(0, fetcher_1.commitCursors)(config, []);
|
|
137
143
|
consecutiveFailures = 0;
|
|
138
144
|
}
|
|
139
145
|
}
|
package/dist/src/sender.js
CHANGED
|
@@ -49,6 +49,9 @@ const log = __importStar(require("./log"));
|
|
|
49
49
|
const version_1 = require("./version");
|
|
50
50
|
const BATCH_SIZE = 100;
|
|
51
51
|
exports.REQUEST_TIMEOUT_MS = 30_000;
|
|
52
|
+
/** Minimum delay between consecutive batch POSTs (ms). Prevents Cloud Armor rate-limit
|
|
53
|
+
* from triggering during backfill bursts. 200ms ≈ 5 req/s = 300 req/min (well under 600/min limit). */
|
|
54
|
+
const INTER_BATCH_DELAY_MS = 200;
|
|
52
55
|
function errMsg(err) {
|
|
53
56
|
return err instanceof Error ? err.message : String(err);
|
|
54
57
|
}
|
|
@@ -97,6 +100,9 @@ async function sendEvents(events, config) {
|
|
|
97
100
|
}
|
|
98
101
|
const results = [];
|
|
99
102
|
for (let i = 0; i < events.length; i += BATCH_SIZE) {
|
|
103
|
+
// Throttle between batches to avoid Cloud Armor rate-limit during backfill
|
|
104
|
+
if (i > 0)
|
|
105
|
+
await new Promise(r => setTimeout(r, INTER_BATCH_DELAY_MS));
|
|
100
106
|
const batch = events.slice(i, i + BATCH_SIZE);
|
|
101
107
|
const batchNum = Math.floor(i / BATCH_SIZE) + 1;
|
|
102
108
|
const payload = JSON.stringify({ entries: batch });
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upx-us/shield",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15-beta",
|
|
4
4
|
"description": "Security monitoring plugin for OpenClaw agents — streams enriched security events to the Shield detection platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|