@profullstack/threatcrush 0.10.0 → 0.11.0

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
@@ -10473,9 +10473,13 @@ var CODE_RULES = [
10473
10473
  severity: "high",
10474
10474
  languages: ["python"],
10475
10475
  // An f-string whose content is an LDAP filter (`(&…` / `(|…`) with an
10476
- // interpolation. The safe form escapes, so the window carries an escaper.
10477
- pattern: /\bf['"][^'"\n]*\([&|][^'"\n]*\{[^}\n]+\}/,
10478
- guard: /escap/i
10476
+ // interpolation. One variant per quote so an inner `'` inside a `"`-string
10477
+ // does not end the class early.
10478
+ pattern: /\bf"[^"\n]*\([&|][^"\n]*\{[^}\n]+\}|\bf'[^'\n]*\([&|][^'\n]*\{[^}\n]+\}/,
10479
+ // The guard is an escaper *call*, not the mere presence of `escape` — the
10480
+ // module-level `from ldap.filter import escape_filter_chars` sits in every
10481
+ // window and would otherwise exonerate the unescaped filter too.
10482
+ guard: /\bescape\w*\s*\(/i
10479
10483
  },
10480
10484
  {
10481
10485
  id: "py-xpath-injection",
@@ -10484,7 +10488,9 @@ var CODE_RULES = [
10484
10488
  cwe: "CWE-643",
10485
10489
  severity: "high",
10486
10490
  languages: ["python"],
10487
- pattern: /\bf['"][^'"\n]*(?:\/\/|\/\w+\[)[^'"\n]*\{[^}\n]+\}/
10491
+ // Per-quote, so an inner `'` in a `"`-delimited f-string (`text()='{x}'`)
10492
+ // does not truncate the match before the interpolation.
10493
+ pattern: /\bf"[^"\n]*(?:\/\/|\/\w+\[)[^"\n]*\{[^}\n]+\}|\bf'[^'\n]*(?:\/\/|\/\w+\[)[^'\n]*\{[^}\n]+\}/
10488
10494
  },
10489
10495
  {
10490
10496
  id: "py-fast-password-hash",
@@ -10554,7 +10560,34 @@ var CODE_RULES = [
10554
10560
  severity: "high",
10555
10561
  languages: ["javascript", "typescript"],
10556
10562
  pattern: /\.\s*(?:setHeader|header|set)\s*\(\s*['"`][^'"`\n]+['"`]\s*,\s*(?:req|request|ctx)\s*\.\s*(?:query|body|params|headers)\b/
10557
- }
10563
+ },
10564
+ {
10565
+ id: "js-nosql-injection",
10566
+ title: "NoSQL query built from request data",
10567
+ consequence: 'A request object passed straight to `find`/`update` lets the caller supply MongoDB operators \u2014 `{"$ne": null}`, `{"$gt": ""}`, `{"$where": "\u2026"}` \u2014 turning a lookup into an authentication bypass or arbitrary query.',
10568
+ cwe: "CWE-943",
10569
+ severity: "high",
10570
+ languages: ["javascript", "typescript"],
10571
+ pattern: /\.\s*(?:find|findOne|findOneAndUpdate|updateOne|updateMany|update|deleteOne|deleteMany|remove|count|countDocuments|aggregate)\s*\(\s*(?:req|request|ctx)\s*\.\s*(?:body|query|params)\b/
10572
+ },
10573
+ {
10574
+ id: "js-host-header-trust",
10575
+ title: "URL built from the Host header",
10576
+ consequence: "The Host header is attacker-controlled. Building a link from it \u2014 a password-reset URL above all \u2014 lets an attacker point the victim\u2019s reset token at a domain they control.",
10577
+ cwe: "CWE-346",
10578
+ severity: "high",
10579
+ languages: ["javascript", "typescript"],
10580
+ pattern: /\$\{[^}\n]*\breq(?:uest)?\s*\.\s*(?:headers\s*\.\s*host|hostname|host)\b|['"`]\s*\+\s*req(?:uest)?\s*\.\s*(?:headers\s*\.\s*host|hostname)\b/
10581
+ }
10582
+ // A recursive-merge prototype-pollution rule (`target[key] = source[key]`
10583
+ // with no `__proto__` guard) was built and dropped. The bare copy-by-key is
10584
+ // the safe allow-listed shape (`updates[field] = body[field]` over an
10585
+ // `allowedFields` list) as often as the vulnerable one; whether it is a sink
10586
+ // depends on where the key comes from and which of endless guard idioms
10587
+ // filters it — a whole-function question this line-oriented engine does not
10588
+ // answer. It flagged legitimate merges in Capacitor and in this repo's own
10589
+ // web app. `js-prototype-pollution` still catches the explicit `__proto__`
10590
+ // literal; the recursive-merge case is left to KNOWN_GAPS.
10558
10591
  ];
10559
10592
  var COMMENT_PREFIX = /^\s*(?:\/\/|\/\*|\*|#|--|<!--)/;
10560
10593
  var DEFINITION_PREFIX = /^\s*(?:(?:export|public|private|protected|static|final|async|abstract)\s+)*(?:def|function|func|class|module|interface|struct|impl|fn|sub)\b/;