@remcp/remcp 0.2.113 → 0.2.114
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/package.json +1 -1
- package/src/agent.mjs +14 -1
package/package.json
CHANGED
package/src/agent.mjs
CHANGED
|
@@ -366,10 +366,23 @@ export async function runAgent(options) {
|
|
|
366
366
|
|
|
367
367
|
function scheduleReconnect(delay) {
|
|
368
368
|
if (stopping || revoked || reconnectTimer) return;
|
|
369
|
+
// Keep the upper-bound guard in control flow immediately before the timer sink. CodeQL's
|
|
370
|
+
// resource-exhaustion model treats this as a barrier, and future callers cannot retain the
|
|
371
|
+
// agent with an attacker-controlled timer lifetime.
|
|
372
|
+
const numericDelay = Number(delay);
|
|
373
|
+
if (!Number.isFinite(numericDelay)) {
|
|
374
|
+
scheduleReconnect(RECONNECT_BASE_MS);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (numericDelay > RECONNECT_MAX_MS) {
|
|
378
|
+
scheduleReconnect(RECONNECT_MAX_MS);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const safeDelay = Math.max(100, Math.floor(numericDelay));
|
|
369
382
|
reconnectTimer = setTimeout(() => {
|
|
370
383
|
reconnectTimer = null;
|
|
371
384
|
connect();
|
|
372
|
-
},
|
|
385
|
+
}, safeDelay);
|
|
373
386
|
reconnectTimer.unref?.();
|
|
374
387
|
}
|
|
375
388
|
|