@profullstack/threatcrush 0.13.2 → 0.13.3
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/dist/daemon.js +12 -12
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/daemon.js
CHANGED
|
@@ -9411,18 +9411,6 @@ var RemediationManager = class {
|
|
|
9411
9411
|
if (existing && !opts.ttlSeconds) {
|
|
9412
9412
|
return { ok: false, error: `${ip} is already banned` };
|
|
9413
9413
|
}
|
|
9414
|
-
const strike = recordStrike(this.strikes, ip, now, this.config.strike_memory_seconds);
|
|
9415
|
-
const ttl = opts.ttlSeconds ?? banSeconds(strike, this.config.max_ban_seconds);
|
|
9416
|
-
const entry = {
|
|
9417
|
-
ip,
|
|
9418
|
-
reason,
|
|
9419
|
-
rule_id: opts.ruleId,
|
|
9420
|
-
blocked_at: now,
|
|
9421
|
-
expires_at: now + ttl * 1e3,
|
|
9422
|
-
dry_run: this.config.dry_run,
|
|
9423
|
-
strikes: strike,
|
|
9424
|
-
source: opts.source ?? "manual"
|
|
9425
|
-
};
|
|
9426
9414
|
if (!this.config.dry_run) {
|
|
9427
9415
|
try {
|
|
9428
9416
|
await this.adapter.block(ip);
|
|
@@ -9440,6 +9428,18 @@ var RemediationManager = class {
|
|
|
9440
9428
|
return { ok: false, error: message };
|
|
9441
9429
|
}
|
|
9442
9430
|
}
|
|
9431
|
+
const strike = recordStrike(this.strikes, ip, now, this.config.strike_memory_seconds);
|
|
9432
|
+
const ttl = opts.ttlSeconds ?? banSeconds(strike, this.config.max_ban_seconds);
|
|
9433
|
+
const entry = {
|
|
9434
|
+
ip,
|
|
9435
|
+
reason,
|
|
9436
|
+
rule_id: opts.ruleId,
|
|
9437
|
+
blocked_at: now,
|
|
9438
|
+
expires_at: now + ttl * 1e3,
|
|
9439
|
+
dry_run: this.config.dry_run,
|
|
9440
|
+
strikes: strike,
|
|
9441
|
+
source: opts.source ?? "manual"
|
|
9442
|
+
};
|
|
9443
9443
|
this.blocklist = this.blocklist.filter((b) => b.ip !== ip);
|
|
9444
9444
|
this.blocklist.push(entry);
|
|
9445
9445
|
this.saveState();
|