@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/index.js CHANGED
@@ -25724,18 +25724,6 @@ var RemediationManager = class {
25724
25724
  if (existing && !opts.ttlSeconds) {
25725
25725
  return { ok: false, error: `${ip} is already banned` };
25726
25726
  }
25727
- const strike = recordStrike(this.strikes, ip, now, this.config.strike_memory_seconds);
25728
- const ttl = opts.ttlSeconds ?? banSeconds(strike, this.config.max_ban_seconds);
25729
- const entry = {
25730
- ip,
25731
- reason,
25732
- rule_id: opts.ruleId,
25733
- blocked_at: now,
25734
- expires_at: now + ttl * 1e3,
25735
- dry_run: this.config.dry_run,
25736
- strikes: strike,
25737
- source: opts.source ?? "manual"
25738
- };
25739
25727
  if (!this.config.dry_run) {
25740
25728
  try {
25741
25729
  await this.adapter.block(ip);
@@ -25753,6 +25741,18 @@ var RemediationManager = class {
25753
25741
  return { ok: false, error: message };
25754
25742
  }
25755
25743
  }
25744
+ const strike = recordStrike(this.strikes, ip, now, this.config.strike_memory_seconds);
25745
+ const ttl = opts.ttlSeconds ?? banSeconds(strike, this.config.max_ban_seconds);
25746
+ const entry = {
25747
+ ip,
25748
+ reason,
25749
+ rule_id: opts.ruleId,
25750
+ blocked_at: now,
25751
+ expires_at: now + ttl * 1e3,
25752
+ dry_run: this.config.dry_run,
25753
+ strikes: strike,
25754
+ source: opts.source ?? "manual"
25755
+ };
25756
25756
  this.blocklist = this.blocklist.filter((b) => b.ip !== ip);
25757
25757
  this.blocklist.push(entry);
25758
25758
  this.saveState();