@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/daemon.js CHANGED
@@ -5203,9 +5203,13 @@ var CODE_RULES = [
5203
5203
  severity: "high",
5204
5204
  languages: ["python"],
5205
5205
  // An f-string whose content is an LDAP filter (`(&…` / `(|…`) with an
5206
- // interpolation. The safe form escapes, so the window carries an escaper.
5207
- pattern: /\bf['"][^'"\n]*\([&|][^'"\n]*\{[^}\n]+\}/,
5208
- guard: /escap/i
5206
+ // interpolation. One variant per quote so an inner `'` inside a `"`-string
5207
+ // does not end the class early.
5208
+ pattern: /\bf"[^"\n]*\([&|][^"\n]*\{[^}\n]+\}|\bf'[^'\n]*\([&|][^'\n]*\{[^}\n]+\}/,
5209
+ // The guard is an escaper *call*, not the mere presence of `escape` — the
5210
+ // module-level `from ldap.filter import escape_filter_chars` sits in every
5211
+ // window and would otherwise exonerate the unescaped filter too.
5212
+ guard: /\bescape\w*\s*\(/i
5209
5213
  },
5210
5214
  {
5211
5215
  id: "py-xpath-injection",
@@ -5214,7 +5218,9 @@ var CODE_RULES = [
5214
5218
  cwe: "CWE-643",
5215
5219
  severity: "high",
5216
5220
  languages: ["python"],
5217
- pattern: /\bf['"][^'"\n]*(?:\/\/|\/\w+\[)[^'"\n]*\{[^}\n]+\}/
5221
+ // Per-quote, so an inner `'` in a `"`-delimited f-string (`text()='{x}'`)
5222
+ // does not truncate the match before the interpolation.
5223
+ pattern: /\bf"[^"\n]*(?:\/\/|\/\w+\[)[^"\n]*\{[^}\n]+\}|\bf'[^'\n]*(?:\/\/|\/\w+\[)[^'\n]*\{[^}\n]+\}/
5218
5224
  },
5219
5225
  {
5220
5226
  id: "py-fast-password-hash",
@@ -5284,7 +5290,34 @@ var CODE_RULES = [
5284
5290
  severity: "high",
5285
5291
  languages: ["javascript", "typescript"],
5286
5292
  pattern: /\.\s*(?:setHeader|header|set)\s*\(\s*['"`][^'"`\n]+['"`]\s*,\s*(?:req|request|ctx)\s*\.\s*(?:query|body|params|headers)\b/
5287
- }
5293
+ },
5294
+ {
5295
+ id: "js-nosql-injection",
5296
+ title: "NoSQL query built from request data",
5297
+ 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.',
5298
+ cwe: "CWE-943",
5299
+ severity: "high",
5300
+ languages: ["javascript", "typescript"],
5301
+ 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/
5302
+ },
5303
+ {
5304
+ id: "js-host-header-trust",
5305
+ title: "URL built from the Host header",
5306
+ 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.",
5307
+ cwe: "CWE-346",
5308
+ severity: "high",
5309
+ languages: ["javascript", "typescript"],
5310
+ 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/
5311
+ }
5312
+ // A recursive-merge prototype-pollution rule (`target[key] = source[key]`
5313
+ // with no `__proto__` guard) was built and dropped. The bare copy-by-key is
5314
+ // the safe allow-listed shape (`updates[field] = body[field]` over an
5315
+ // `allowedFields` list) as often as the vulnerable one; whether it is a sink
5316
+ // depends on where the key comes from and which of endless guard idioms
5317
+ // filters it — a whole-function question this line-oriented engine does not
5318
+ // answer. It flagged legitimate merges in Capacitor and in this repo's own
5319
+ // web app. `js-prototype-pollution` still catches the explicit `__proto__`
5320
+ // literal; the recursive-merge case is left to KNOWN_GAPS.
5288
5321
  ];
5289
5322
  var COMMENT_PREFIX = /^\s*(?:\/\/|\/\*|\*|#|--|<!--)/;
5290
5323
  var DEFINITION_PREFIX = /^\s*(?:(?:export|public|private|protected|static|final|async|abstract)\s+)*(?:def|function|func|class|module|interface|struct|impl|fn|sub)\b/;