@profullstack/threatcrush 0.13.44 → 0.13.46

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 CHANGED
@@ -9110,6 +9110,11 @@ var DEFAULT_EXCLUDED_RULE_IDS = [941130];
9110
9110
  var ARGUMENT_EXCLUSIONS = [
9111
9111
  { ruleIds: [942100], path: /^\/rest\/v1\//, arg: "select", value: /^[A-Za-z0-9_*,.:!()>-]+$/ }
9112
9112
  ];
9113
+ var COMMAND_WORD_RULE_IDS = /* @__PURE__ */ new Set([932260, 932340, 932370, 932380]);
9114
+ var PLAIN_WORDS = /^[\p{L}\p{N}][\p{L}\p{N} .,_+/-]*(?: & [\p{L}\p{N}][\p{L}\p{N} .,_+/-]*)*$/u;
9115
+ function isPlainWords(value) {
9116
+ return value.length <= 200 && PLAIN_WORDS.test(value);
9117
+ }
9113
9118
  var ATTACK_TYPES = {
9114
9119
  "attack-sqli": "sqli",
9115
9120
  "attack-xss": "xss",
@@ -9262,6 +9267,7 @@ var RequestContext = class {
9262
9267
  const exclusions = ARGUMENT_EXCLUSIONS.filter((e) => e.path.test(path));
9263
9268
  return parseArguments(query).map(({ name, value }) => {
9264
9269
  const ids = exclusions.filter((e) => e.arg === name && e.value.test(value)).flatMap((e) => e.ruleIds);
9270
+ if (isPlainWords(value)) ids.push(...COMMAND_WORD_RULE_IDS);
9265
9271
  return { value, cache: /* @__PURE__ */ new Map(), ...ids.length ? { excluded: new Set(ids) } : {} };
9266
9272
  });
9267
9273
  }
@@ -10182,6 +10188,38 @@ var DEFAULT_PROTECTED = [
10182
10188
  "fc00::/7",
10183
10189
  "fe80::/10"
10184
10190
  ];
10191
+ var SHARED_INFRASTRUCTURE = [
10192
+ "173.245.48.0/20",
10193
+ "103.21.244.0/22",
10194
+ "103.22.200.0/22",
10195
+ "103.31.4.0/22",
10196
+ "141.101.64.0/18",
10197
+ "108.162.192.0/18",
10198
+ "190.93.240.0/20",
10199
+ "188.114.96.0/20",
10200
+ "197.234.240.0/22",
10201
+ "198.41.128.0/17",
10202
+ "162.158.0.0/15",
10203
+ "104.16.0.0/13",
10204
+ "104.24.0.0/14",
10205
+ "172.64.0.0/13",
10206
+ "131.0.72.0/22",
10207
+ "2400:cb00::/32",
10208
+ "2606:4700::/32",
10209
+ "2803:f800::/32",
10210
+ "2405:b500::/32",
10211
+ "2405:8100::/32",
10212
+ "2a06:98c0::/29",
10213
+ "2c0f:f248::/32",
10214
+ "1.1.1.1/32",
10215
+ "1.0.0.1/32",
10216
+ "8.8.8.8/32",
10217
+ "8.8.4.4/32",
10218
+ "9.9.9.9/32",
10219
+ "149.112.112.112/32",
10220
+ "208.67.222.222/32",
10221
+ "208.67.220.220/32"
10222
+ ];
10185
10223
  function ipToBytes(ip) {
10186
10224
  const version = (0, import_node_net2.isIP)(ip);
10187
10225
  if (version === 4) return v4ToBytes(ip);
@@ -18843,7 +18881,7 @@ var RemediationManager = class {
18843
18881
  this.discovery = discovery;
18844
18882
  this.config = { ...DEFAULT_CONFIG2, ...config };
18845
18883
  this.config.allowlist = [...this.config.allowlist];
18846
- this.protectedList = [...DEFAULT_PROTECTED, ...this.config.allowlist];
18884
+ this.protectedList = [...DEFAULT_PROTECTED, ...SHARED_INFRASTRUCTURE, ...this.config.allowlist];
18847
18885
  for (const gateway of defaultGateways()) this.protectedList.push(gateway);
18848
18886
  if (this.adapter.enforces === false) this.config.dry_run = true;
18849
18887
  this.loadState();
@@ -19126,8 +19164,10 @@ var RemediationManager = class {
19126
19164
  */
19127
19165
  async reconcile() {
19128
19166
  const now = Date.now();
19129
- const live2 = this.blocklist.filter((b) => b.expires_at > now);
19130
- const stale = this.blocklist.filter((b) => b.expires_at <= now);
19167
+ const lifted = this.blocklist.filter((b) => this.isAllowlisted(b.ip));
19168
+ for (const entry of lifted) this.logLine(`[firewall] reconcile: lifting ban on protected ${entry.ip}`);
19169
+ const live2 = this.blocklist.filter((b) => b.expires_at > now && !this.isAllowlisted(b.ip));
19170
+ const stale = this.blocklist.filter((b) => b.expires_at <= now || this.isAllowlisted(b.ip));
19131
19171
  for (const entry of stale) {
19132
19172
  if (!entry.dry_run) {
19133
19173
  try {