circle-ir 4.23.0 → 4.24.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.
Files changed (179) hide show
  1. package/configs/sink-semantics.json +6 -0
  2. package/dist/analysis/config-loader.d.ts.map +1 -1
  3. package/dist/analysis/config-loader.js +18 -5
  4. package/dist/analysis/config-loader.js.map +1 -1
  5. package/dist/analysis/findings.d.ts +8 -1
  6. package/dist/analysis/findings.d.ts.map +1 -1
  7. package/dist/analysis/findings.js +67 -5
  8. package/dist/analysis/findings.js.map +1 -1
  9. package/dist/analysis/hono-env.d.ts +24 -0
  10. package/dist/analysis/hono-env.d.ts.map +1 -0
  11. package/dist/analysis/hono-env.js +105 -0
  12. package/dist/analysis/hono-env.js.map +1 -0
  13. package/dist/analysis/html/html-extractor.d.ts +6 -0
  14. package/dist/analysis/html/html-extractor.d.ts.map +1 -1
  15. package/dist/analysis/html/html-extractor.js +16 -0
  16. package/dist/analysis/html/html-extractor.js.map +1 -1
  17. package/dist/analysis/interprocedural.d.ts.map +1 -1
  18. package/dist/analysis/interprocedural.js +51 -2
  19. package/dist/analysis/interprocedural.js.map +1 -1
  20. package/dist/analysis/js-helper-return.d.ts +7 -0
  21. package/dist/analysis/js-helper-return.d.ts.map +1 -1
  22. package/dist/analysis/js-helper-return.js +165 -0
  23. package/dist/analysis/js-helper-return.js.map +1 -1
  24. package/dist/analysis/js-spawn-argv.d.ts +34 -0
  25. package/dist/analysis/js-spawn-argv.d.ts.map +1 -0
  26. package/dist/analysis/js-spawn-argv.js +156 -0
  27. package/dist/analysis/js-spawn-argv.js.map +1 -0
  28. package/dist/analysis/maven-declared.d.ts.map +1 -1
  29. package/dist/analysis/maven-declared.js +5 -1
  30. package/dist/analysis/maven-declared.js.map +1 -1
  31. package/dist/analysis/passes/cli-main-reflection-suppress-pass.d.ts +1 -1
  32. package/dist/analysis/passes/cli-main-reflection-suppress-pass.d.ts.map +1 -1
  33. package/dist/analysis/passes/cli-main-reflection-suppress-pass.js +3 -1
  34. package/dist/analysis/passes/cli-main-reflection-suppress-pass.js.map +1 -1
  35. package/dist/analysis/passes/cross-file-pass.d.ts.map +1 -1
  36. package/dist/analysis/passes/cross-file-pass.js +2 -1
  37. package/dist/analysis/passes/cross-file-pass.js.map +1 -1
  38. package/dist/analysis/passes/interprocedural-pass.d.ts.map +1 -1
  39. package/dist/analysis/passes/interprocedural-pass.js +113 -2
  40. package/dist/analysis/passes/interprocedural-pass.js.map +1 -1
  41. package/dist/analysis/passes/language-sources-pass.d.ts +15 -0
  42. package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
  43. package/dist/analysis/passes/language-sources-pass.js +1414 -33
  44. package/dist/analysis/passes/language-sources-pass.js.map +1 -1
  45. package/dist/analysis/passes/module-side-effect-pass.d.ts +9 -0
  46. package/dist/analysis/passes/module-side-effect-pass.d.ts.map +1 -1
  47. package/dist/analysis/passes/module-side-effect-pass.js +30 -3
  48. package/dist/analysis/passes/module-side-effect-pass.js.map +1 -1
  49. package/dist/analysis/passes/orphan-module-pass.d.ts +6 -1
  50. package/dist/analysis/passes/orphan-module-pass.d.ts.map +1 -1
  51. package/dist/analysis/passes/orphan-module-pass.js +6 -1
  52. package/dist/analysis/passes/orphan-module-pass.js.map +1 -1
  53. package/dist/analysis/passes/param-source-flow-gate-pass.d.ts.map +1 -1
  54. package/dist/analysis/passes/param-source-flow-gate-pass.js +2 -1
  55. package/dist/analysis/passes/param-source-flow-gate-pass.js.map +1 -1
  56. package/dist/analysis/passes/scan-secrets-pass.d.ts +8 -0
  57. package/dist/analysis/passes/scan-secrets-pass.d.ts.map +1 -1
  58. package/dist/analysis/passes/scan-secrets-pass.js +78 -10
  59. package/dist/analysis/passes/scan-secrets-pass.js.map +1 -1
  60. package/dist/analysis/passes/sink-filter-pass.d.ts +17 -0
  61. package/dist/analysis/passes/sink-filter-pass.d.ts.map +1 -1
  62. package/dist/analysis/passes/sink-filter-pass.js +687 -4
  63. package/dist/analysis/passes/sink-filter-pass.js.map +1 -1
  64. package/dist/analysis/passes/taint-propagation-pass.d.ts +19 -0
  65. package/dist/analysis/passes/taint-propagation-pass.d.ts.map +1 -1
  66. package/dist/analysis/passes/taint-propagation-pass.js +40 -1
  67. package/dist/analysis/passes/taint-propagation-pass.js.map +1 -1
  68. package/dist/analysis/require-entry-path.d.ts +4 -1
  69. package/dist/analysis/require-entry-path.d.ts.map +1 -1
  70. package/dist/analysis/require-entry-path.js +150 -7
  71. package/dist/analysis/require-entry-path.js.map +1 -1
  72. package/dist/analysis/rules.d.ts +7 -0
  73. package/dist/analysis/rules.d.ts.map +1 -1
  74. package/dist/analysis/rules.js +65 -0
  75. package/dist/analysis/rules.js.map +1 -1
  76. package/dist/analysis/sbom.d.ts +32 -4
  77. package/dist/analysis/sbom.d.ts.map +1 -1
  78. package/dist/analysis/sbom.js +57 -19
  79. package/dist/analysis/sbom.js.map +1 -1
  80. package/dist/analysis/taint-matcher.d.ts.map +1 -1
  81. package/dist/analysis/taint-matcher.js +85 -8
  82. package/dist/analysis/taint-matcher.js.map +1 -1
  83. package/dist/analysis/taint-propagation.d.ts +7 -0
  84. package/dist/analysis/taint-propagation.d.ts.map +1 -1
  85. package/dist/analysis/taint-propagation.js +84 -0
  86. package/dist/analysis/taint-propagation.js.map +1 -1
  87. package/dist/analysis/test-to-production-taint-gate.d.ts.map +1 -1
  88. package/dist/analysis/test-to-production-taint-gate.js +6 -2
  89. package/dist/analysis/test-to-production-taint-gate.js.map +1 -1
  90. package/dist/analyzer.d.ts +30 -5
  91. package/dist/analyzer.d.ts.map +1 -1
  92. package/dist/analyzer.js +93 -13
  93. package/dist/analyzer.js.map +1 -1
  94. package/dist/browser/circle-ir.js +11388 -8828
  95. package/dist/core/circle-ir-core.cjs +307 -27
  96. package/dist/core/circle-ir-core.js +307 -27
  97. package/dist/core/extractors/calls.d.ts.map +1 -1
  98. package/dist/core/extractors/calls.js +83 -1
  99. package/dist/core/extractors/calls.js.map +1 -1
  100. package/dist/core/extractors/meta.d.ts +3 -2
  101. package/dist/core/extractors/meta.d.ts.map +1 -1
  102. package/dist/core/extractors/meta.js +3 -2
  103. package/dist/core/extractors/meta.js.map +1 -1
  104. package/dist/core/extractors/runtime-registrations.js +5 -2
  105. package/dist/core/extractors/runtime-registrations.js.map +1 -1
  106. package/dist/core/extractors/types.d.ts +3 -2
  107. package/dist/core/extractors/types.d.ts.map +1 -1
  108. package/dist/core/extractors/types.js +22 -20
  109. package/dist/core/extractors/types.js.map +1 -1
  110. package/dist/core/index.d.ts +1 -1
  111. package/dist/core/index.d.ts.map +1 -1
  112. package/dist/core/index.js +1 -1
  113. package/dist/core/index.js.map +1 -1
  114. package/dist/core/parser.d.ts +11 -6
  115. package/dist/core/parser.d.ts.map +1 -1
  116. package/dist/core/parser.js +29 -5
  117. package/dist/core/parser.js.map +1 -1
  118. package/dist/core/partial-parse-recovery.d.ts +26 -0
  119. package/dist/core/partial-parse-recovery.d.ts.map +1 -0
  120. package/dist/core/partial-parse-recovery.js +129 -0
  121. package/dist/core/partial-parse-recovery.js.map +1 -0
  122. package/dist/graph/code-graph.d.ts +1 -0
  123. package/dist/graph/code-graph.d.ts.map +1 -1
  124. package/dist/graph/code-graph.js +1 -0
  125. package/dist/graph/code-graph.js.map +1 -1
  126. package/dist/graph/import-graph.d.ts +14 -4
  127. package/dist/graph/import-graph.d.ts.map +1 -1
  128. package/dist/graph/import-graph.js +72 -9
  129. package/dist/graph/import-graph.js.map +1 -1
  130. package/dist/graph-facts/dead-code.d.ts +2 -0
  131. package/dist/graph-facts/dead-code.d.ts.map +1 -1
  132. package/dist/graph-facts/dead-code.js +126 -1
  133. package/dist/graph-facts/dead-code.js.map +1 -1
  134. package/dist/graph-facts/index.d.ts +1 -1
  135. package/dist/graph-facts/index.d.ts.map +1 -1
  136. package/dist/graph-facts/index.js +1 -1
  137. package/dist/graph-facts/index.js.map +1 -1
  138. package/dist/index.d.ts +3 -2
  139. package/dist/index.d.ts.map +1 -1
  140. package/dist/index.js +2 -1
  141. package/dist/index.js.map +1 -1
  142. package/dist/languages/plugins/javascript.d.ts.map +1 -1
  143. package/dist/languages/plugins/javascript.js +1 -1
  144. package/dist/languages/plugins/javascript.js.map +1 -1
  145. package/dist/languages/registry.d.ts.map +1 -1
  146. package/dist/languages/registry.js +12 -0
  147. package/dist/languages/registry.js.map +1 -1
  148. package/dist/navigation/index.d.ts +1 -1
  149. package/dist/navigation/index.d.ts.map +1 -1
  150. package/dist/navigation/index.js.map +1 -1
  151. package/dist/navigation/navigation-index.js +3 -1
  152. package/dist/navigation/navigation-index.js.map +1 -1
  153. package/dist/navigation/python-graph.d.ts +3 -1
  154. package/dist/navigation/python-graph.d.ts.map +1 -1
  155. package/dist/navigation/python-graph.js +236 -23
  156. package/dist/navigation/python-graph.js.map +1 -1
  157. package/dist/navigation/ts-call-edges.d.ts +18 -0
  158. package/dist/navigation/ts-call-edges.d.ts.map +1 -1
  159. package/dist/navigation/ts-call-edges.js +207 -18
  160. package/dist/navigation/ts-call-edges.js.map +1 -1
  161. package/dist/path-set/path-set.d.ts +5 -2
  162. package/dist/path-set/path-set.d.ts.map +1 -1
  163. package/dist/path-set/path-set.js +4 -1
  164. package/dist/path-set/path-set.js.map +1 -1
  165. package/dist/resolution/cross-file.d.ts +12 -0
  166. package/dist/resolution/cross-file.d.ts.map +1 -1
  167. package/dist/resolution/cross-file.js +357 -3
  168. package/dist/resolution/cross-file.js.map +1 -1
  169. package/dist/stable-ids/ts-parse-errors.d.ts +2 -0
  170. package/dist/stable-ids/ts-parse-errors.d.ts.map +1 -1
  171. package/dist/stable-ids/ts-parse-errors.js +43 -1
  172. package/dist/stable-ids/ts-parse-errors.js.map +1 -1
  173. package/dist/types/config.d.ts +2 -1
  174. package/dist/types/config.d.ts.map +1 -1
  175. package/dist/types/index.d.ts +74 -5
  176. package/dist/types/index.d.ts.map +1 -1
  177. package/dist/types/index.js.map +1 -1
  178. package/docs/SPEC.md +1 -1
  179. package/package.json +2 -2
@@ -4339,7 +4339,7 @@ init_parser();
4339
4339
  function extractMeta(code, tree, filePath, language) {
4340
4340
  const loc = countLinesOfCode(code);
4341
4341
  const hash = computeHash(code);
4342
- const pkg = extractPackage(tree, language);
4342
+ const pkg = tree ? extractPackage(tree, language) : null;
4343
4343
  return {
4344
4344
  circle_ir: "3.0",
4345
4345
  file: filePath,
@@ -4643,19 +4643,6 @@ function extractJavaTypes(tree, cache, options) {
4643
4643
  types.push(extractEnumInfo(enumDecl));
4644
4644
  }
4645
4645
  if (!options?.navigationTypes) return types;
4646
- for (const enumDecl of enums) {
4647
- const info2 = types.find(
4648
- (t) => t.kind === "enum" && t.start_line === enumDecl.startPosition.row + 1 && t.name === getIdentifier(enumDecl, "name")
4649
- );
4650
- const body2 = enumDecl.childForFieldName("body");
4651
- if (!info2 || !body2) continue;
4652
- for (let i2 = 0; i2 < body2.childCount; i2++) {
4653
- const decls = body2.child(i2);
4654
- if (decls?.type !== "enum_body_declarations") continue;
4655
- info2.methods.push(...extractMethods(decls));
4656
- info2.fields.push(...extractFields(decls));
4657
- }
4658
- }
4659
4646
  const methodsByStart = /* @__PURE__ */ new Map();
4660
4647
  for (const t of types) {
4661
4648
  for (const m of t.methods) methodsByStart.set(`${m.start_line}:${m.name}`, m);
@@ -5603,6 +5590,11 @@ function extractEnumInfo(node) {
5603
5590
  const body2 = node.childForFieldName("body");
5604
5591
  const methods = body2 ? extractMethods(body2) : [];
5605
5592
  const fields = body2 ? extractFields(body2) : [];
5593
+ for (const decls of body2?.children ?? []) {
5594
+ if (decls?.type !== "enum_body_declarations") continue;
5595
+ methods.push(...extractMethods(decls));
5596
+ fields.push(...extractFields(decls));
5597
+ }
5606
5598
  const pkg = extractPackageFromAncestors(node);
5607
5599
  return {
5608
5600
  name: name2,
@@ -5630,6 +5622,13 @@ function extractMethods(body2) {
5630
5622
  if (child.type === "method_declaration" || child.type === "constructor_declaration") {
5631
5623
  methods.push(extractMethodInfo(child, precedingComment));
5632
5624
  precedingComment = null;
5625
+ } else if (child.type === "compact_constructor_declaration") {
5626
+ const info2 = extractMethodInfo(child, precedingComment);
5627
+ const rec = body2.parent?.type === "record_declaration" ? body2.parent : null;
5628
+ const params = rec?.childForFieldName("parameters");
5629
+ if (params) info2.parameters = extractParameters(params);
5630
+ methods.push(info2);
5631
+ precedingComment = null;
5633
5632
  } else {
5634
5633
  precedingComment = null;
5635
5634
  }
@@ -5637,7 +5636,7 @@ function extractMethods(body2) {
5637
5636
  return methods;
5638
5637
  }
5639
5638
  function extractMethodInfo(node, precedingComment = null) {
5640
- const isConstructor = node.type === "constructor_declaration";
5639
+ const isConstructor = node.type === "constructor_declaration" || node.type === "compact_constructor_declaration";
5641
5640
  const name2 = getIdentifier(node, "name") ?? (isConstructor ? "<init>" : "unknown");
5642
5641
  const returnTypeNode = node.childForFieldName("type");
5643
5642
  const returnType = returnTypeNode ? getNodeText(returnTypeNode) : isConstructor ? null : "void";
@@ -6322,6 +6321,10 @@ function extractCalls(tree, cache, language, options = {}) {
6322
6321
  calls.push(callInfo);
6323
6322
  }
6324
6323
  }
6324
+ for (const ref of getNodesFromCache(tree.rootNode, "method_reference", cache)) {
6325
+ const callInfo = extractMethodReference(ref, context);
6326
+ if (callInfo) calls.push(callInfo);
6327
+ }
6325
6328
  if (typed) {
6326
6329
  for (const inv of getNodesFromCache(tree.rootNode, "explicit_constructor_invocation", cache)) {
6327
6330
  const callInfo = extractExplicitConstructorInvocation(inv, context);
@@ -7433,6 +7436,47 @@ function extractObjectCreation(node, context, typed = false) {
7433
7436
  resolution
7434
7437
  };
7435
7438
  }
7439
+ function extractMethodReference(node, context) {
7440
+ const target = node.namedChildren[0];
7441
+ if (!target) return null;
7442
+ const isNew = node.children.some((c) => c?.type === "new");
7443
+ if (isNew && target.type === "array_type") return null;
7444
+ const location = { line: node.startPosition.row + 1, column: node.startPosition.column };
7445
+ const inMethod = findEnclosingMethod(node);
7446
+ const written = getNodeText(target);
7447
+ if (isNew) {
7448
+ const { simpleName: simpleName2, fqn: fqn2 } = resolveFqn(stripGenerics(written), context);
7449
+ return {
7450
+ method_name: written,
7451
+ receiver: null,
7452
+ receiver_type: simpleName2,
7453
+ receiver_type_fqn: fqn2,
7454
+ arguments: [],
7455
+ location,
7456
+ in_method: inMethod,
7457
+ reference_form: "constructor",
7458
+ resolved: true,
7459
+ resolution: { status: "resolved", target: `${written}.<init>` }
7460
+ };
7461
+ }
7462
+ const nameNode = node.namedChildren[node.namedChildCount - 1];
7463
+ if (!nameNode || nameNode.type !== "identifier" || nameNode === target) return null;
7464
+ const methodName = getNodeText(nameNode);
7465
+ const { resolved, resolution } = resolveMethodCall(methodName, written, context);
7466
+ const { simpleName, fqn } = resolveReceiverType(stripGenerics(written), context);
7467
+ return {
7468
+ method_name: methodName,
7469
+ receiver: written,
7470
+ receiver_type: simpleName,
7471
+ receiver_type_fqn: fqn,
7472
+ arguments: [],
7473
+ location,
7474
+ in_method: inMethod,
7475
+ reference_form: target.type === "super" ? "super" : "method",
7476
+ resolved,
7477
+ resolution
7478
+ };
7479
+ }
7436
7480
  var JAVA_TYPE_DECLARATIONS = /* @__PURE__ */ new Set(["class_declaration", "interface_declaration", "enum_declaration", "record_declaration"]);
7437
7481
  function extractExplicitConstructorInvocation(node, context) {
7438
7482
  const kind = node.childForFieldName("constructor")?.type;
@@ -7838,6 +7882,21 @@ function findEnclosingMethod(node) {
7838
7882
  }
7839
7883
  return "<init>";
7840
7884
  }
7885
+ return findEnclosingFieldInitializer(node);
7886
+ }
7887
+ function findEnclosingFieldInitializer(node) {
7888
+ for (let cur = node, parent = node.parent; parent; cur = parent, parent = parent.parent) {
7889
+ if (parent.type === "constant_declaration") return "<clinit>";
7890
+ if (parent.type === "enum_constant") {
7891
+ return cur.type === "argument_list" ? "<clinit>" : null;
7892
+ }
7893
+ if (parent.type === "field_declaration") {
7894
+ const body2 = parent.parent?.type;
7895
+ if (body2 !== "class_body" && body2 !== "enum_body_declarations") return null;
7896
+ const modifiers = parent.namedChildren.find((c) => c?.type === "modifiers");
7897
+ return modifiers?.children.some((c) => c?.type === "static") ? "<clinit>" : "<init>";
7898
+ }
7899
+ }
7841
7900
  return null;
7842
7901
  }
7843
7902
  function resolveMethodCall(methodName, receiver, context) {
@@ -8229,7 +8288,8 @@ function extractPythonLiteral(node) {
8229
8288
  return null;
8230
8289
  }
8231
8290
  }
8232
- return text.replace(/^['"]|['"]$/g, "").replace(/^f['"]|['"]$/g, "");
8291
+ const m = /^[rRbBuUfF]{0,2}("""|'''|"|')([\s\S]*)\1$/.exec(text);
8292
+ return m ? m[2] : text;
8233
8293
  }
8234
8294
  return text;
8235
8295
  }
@@ -12248,6 +12308,9 @@ function runsArgvAsCommand(program) {
12248
12308
  return ARG_EXECUTING_PROGRAMS.has(base);
12249
12309
  }
12250
12310
 
12311
+ // src/analysis/js-spawn-argv.ts
12312
+ var SHELL_OPTION_ON = /\bshell\s*:(?!\s*false\b)/;
12313
+
12251
12314
  // src/analysis/js-helper-return.ts
12252
12315
  function jsHelperReturnsNoParam(sourceCode, rawName) {
12253
12316
  if (!/^[A-Za-z_$][\w$]*$/.test(rawName)) return false;
@@ -12287,6 +12350,126 @@ function jsHelperReturnsNoParam(sourceCode, rawName) {
12287
12350
  }
12288
12351
  return true;
12289
12352
  }
12353
+ var NUMERIC_CALL = /^(?:Number|parseInt|parseFloat|Number\.parseInt|Number\.parseFloat|Math\.[A-Za-z]+)\s*\(/;
12354
+ var NUMERIC_LITERAL = /^-?(?:\d[\d_]*(?:\.\d+)?|0[xX][0-9a-fA-F]+)$/;
12355
+ function closeAt(text, open) {
12356
+ let depth = 0;
12357
+ for (let i2 = open; i2 < text.length; i2++) {
12358
+ const ch = text[i2];
12359
+ if (ch === '"' || ch === "'" || ch === "`") {
12360
+ let j = i2 + 1;
12361
+ for (; j < text.length && text[j] !== ch; j++) if (text[j] === "\\") j++;
12362
+ i2 = j;
12363
+ continue;
12364
+ }
12365
+ if (ch === "(" || ch === "[" || ch === "{") depth++;
12366
+ else if ((ch === ")" || ch === "]" || ch === "}") && --depth === 0) return i2;
12367
+ }
12368
+ return -1;
12369
+ }
12370
+ function splitTernary(expr) {
12371
+ let depth = 0;
12372
+ let q = -1;
12373
+ let nested = 0;
12374
+ for (let i2 = 0; i2 < expr.length; i2++) {
12375
+ const ch = expr[i2];
12376
+ if (ch === '"' || ch === "'" || ch === "`") {
12377
+ let j = i2 + 1;
12378
+ for (; j < expr.length && expr[j] !== ch; j++) if (expr[j] === "\\") j++;
12379
+ i2 = j;
12380
+ continue;
12381
+ }
12382
+ if (ch === "(" || ch === "[" || ch === "{") depth++;
12383
+ else if (ch === ")" || ch === "]" || ch === "}") depth--;
12384
+ else if (depth === 0 && ch === "?" && expr[i2 + 1] !== "." && expr[i2 + 1] !== "?") {
12385
+ if (q < 0) q = i2;
12386
+ else nested++;
12387
+ } else if (depth === 0 && ch === ":" && q >= 0) {
12388
+ if (nested > 0) {
12389
+ nested--;
12390
+ continue;
12391
+ }
12392
+ return [expr.slice(q + 1, i2).trim(), expr.slice(i2 + 1).trim()];
12393
+ }
12394
+ }
12395
+ return null;
12396
+ }
12397
+ function isNumericExpr(expr, body2, params, depth) {
12398
+ let e = expr.trim();
12399
+ if (e.endsWith("number")) {
12400
+ const head = e.slice(0, -"number".length).trimEnd();
12401
+ if (head.length < e.length - "number".length && /\sas$/.test(head)) e = head.slice(0, -2).trimEnd();
12402
+ }
12403
+ while (e.startsWith("(") && closeAt(e, 0) === e.length - 1) e = e.slice(1, -1).trim();
12404
+ if (e === "" || depth > 4) return false;
12405
+ if (NUMERIC_LITERAL.test(e)) return true;
12406
+ const call = NUMERIC_CALL.exec(e);
12407
+ if (call) return closeAt(e, call[0].length - 1) === e.length - 1;
12408
+ if (/^\+\s*[A-Za-z_$][\w$.]*$/.test(e)) return true;
12409
+ const tern = splitTernary(e);
12410
+ if (tern) return tern.every((t) => isNumericExpr(t, body2, params, depth + 1));
12411
+ if (!/^[A-Za-z_$][\w$]*$/.test(e) || params.has(e)) return false;
12412
+ return localIsNumeric(e, body2, params, depth);
12413
+ }
12414
+ function stripBlockComments(text) {
12415
+ let out2 = "";
12416
+ let i2 = 0;
12417
+ for (; ; ) {
12418
+ const open = text.indexOf("/*", i2);
12419
+ const close = open < 0 ? -1 : text.indexOf("*/", open + 2);
12420
+ if (close < 0) return out2 + text.slice(i2);
12421
+ out2 += text.slice(i2, open);
12422
+ i2 = close + 2;
12423
+ }
12424
+ }
12425
+ function localIsNumeric(name2, body2, params, depth) {
12426
+ const esc = name2.replace(/\$/g, "\\$");
12427
+ if (!new RegExp(`\\b(?:const|let|var)\\s+${esc}\\b`).test(body2)) return false;
12428
+ if (new RegExp(`\\b(?:const|let|var)\\s*[{[][^=;]*(?<![\\w$])${esc}(?![\\w$])`).test(body2)) return false;
12429
+ if (new RegExp(`\\b(?:const|let|var)\\s+${esc}\\s+(?:of|in)\\b`).test(body2)) return false;
12430
+ const write = new RegExp(`(?<![\\w$.])${esc}\\s*(?::\\s*number\\s*)?(\\*\\*=|[-*/%]=|\\+=|\\?\\?=|\\|\\|=|&&=|=(?![=>])|\\+\\+|--)`, "g");
12431
+ let writes = 0;
12432
+ for (const m of body2.matchAll(write)) {
12433
+ writes++;
12434
+ const op = m[1];
12435
+ if (op === "++" || op === "--" || /^(?:\*\*|[-*/%])=$/.test(op)) continue;
12436
+ const rhs = /^[^;\n]*/.exec(body2.slice(m.index + m[0].length))[0];
12437
+ if (!isNumericExpr(rhs, body2, params, depth + 1)) return false;
12438
+ }
12439
+ return writes > 0;
12440
+ }
12441
+ function jsHelperReturnsNumber(sourceCode, rawName) {
12442
+ if (!/^[A-Za-z_$][\w$]*$/.test(rawName)) return false;
12443
+ const name2 = rawName.replace(/\$/g, "\\$");
12444
+ const decl = new RegExp(
12445
+ `\\bfunction\\s+${name2}\\s*(?:<[^>]*>)?\\s*\\(([^)]*)\\)[^{]*\\{|\\bconst\\s+${name2}\\s*=\\s*(?:async\\s+)?(?:function\\s*)?\\(([^)]*)\\)[^{=]*(?:=>\\s*)?\\{`,
12446
+ "g"
12447
+ );
12448
+ const decls = [...sourceCode.matchAll(decl)];
12449
+ if (decls.length !== 1) return false;
12450
+ if (new RegExp(`\\b(?:let|var)\\s+${name2}\\s*=|(?<![\\w$.])${name2}\\s*=(?![=>])[^=]`).test(
12451
+ sourceCode.slice(0, decls[0].index) + sourceCode.slice(decls[0].index + decls[0][0].length)
12452
+ )) return false;
12453
+ const open = decls[0].index + decls[0][0].length - 1;
12454
+ const close = closeAt(sourceCode, open);
12455
+ if (close < 0) return false;
12456
+ const body2 = stripBlockComments(sourceCode.slice(open + 1, close)).split("\n").map((l) => {
12457
+ const c = l.indexOf("//");
12458
+ return c < 0 ? l : l.slice(0, c);
12459
+ }).join("\n");
12460
+ if (/\bfunction\b|=>|\byield\b/.test(body2)) return false;
12461
+ const params = new Set(
12462
+ (decls[0][1] ?? decls[0][2] ?? "").split(",").map((p) => /^\s*(?:\.\.\.)?([A-Za-z_$][\w$]*)/.exec(p)?.[1]).filter((p) => !!p)
12463
+ );
12464
+ let returns = 0;
12465
+ for (const m of body2.matchAll(/\breturn\b([^;\n}]*)/g)) {
12466
+ returns++;
12467
+ const after = body2.slice(m.index + m[0].length);
12468
+ if (after.startsWith("\n") && !/^\s*(?:[}A-Za-z_$]|$)/.test(after)) return false;
12469
+ if (!isNumericExpr(m[1], body2, params, 0)) return false;
12470
+ }
12471
+ return returns > 0;
12472
+ }
12290
12473
 
12291
12474
  // src/analysis/literal-expression.ts
12292
12475
  function isProvablyLiteralExpression(expr) {
@@ -12656,6 +12839,10 @@ function jsChainTextAt(sourceLines, line, column) {
12656
12839
  }
12657
12840
 
12658
12841
  // src/analysis/passes/language-sources-pass.ts
12842
+ var JAVA_LITERAL_RHS_RE = /^(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)'|-?\d[\w.]*|true|false|null)$/;
12843
+ var JAVA_NON_THROWING_STMT_RE = new RegExp(
12844
+ `^(?:final\\s+)?(?:[A-Za-z_][\\w.]*(?:<[^;=()]*>)?(?:\\s*\\[\\s*\\])*\\s+)?[A-Za-z_]\\w*\\s*=\\s*(?:${JAVA_LITERAL_RHS_RE.source.slice(1, -1)})\\s*;$`
12845
+ );
12659
12846
  var JINJA_LITERAL_ARG_RE_FRAG = `(?:"[^"\\\\]*"|'[^'\\\\]*')`;
12660
12847
  var JINJA_SAFE_RTS_RE = new RegExp(
12661
12848
  `^(?:flask\\.|jinja2\\.)?render_template_string\\s*\\(\\s*${JINJA_LITERAL_ARG_RE_FRAG}\\s*[,)]`
@@ -14061,7 +14248,10 @@ var DEFAULT_SINKS = [
14061
14248
  { method: "handleDiv", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
14062
14249
  { method: "handleImage", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
14063
14250
  { method: "handleLink", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
14064
- { method: "render", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
14251
+ { method: "render", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["java"] },
14252
+ // Python Jinja/Mako template `.render()` — keep separate from the Java wiki
14253
+ // row so a classless match does not fire on JS/TS locals named `render` (#1432).
14254
+ { method: "render", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["python"] },
14065
14255
  { method: "renderHTML", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
14066
14256
  { method: "parseHTML", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
14067
14257
  // HTML sanitizer/validator sinks (AntiSamy, OWASP HTML Sanitizer, etc.)
@@ -16031,9 +16221,11 @@ var DEFAULT_SANITIZERS = [
16031
16221
  // Type coercion (removes string-based injections)
16032
16222
  // Sprint 29 (#113): include external_taint_escape — a numeric cast cannot
16033
16223
  // carry an unvalidated string payload across a function boundary.
16034
- { method: "parseInt", removes: ["sql_injection", "nosql_injection", "command_injection", "xss", "external_taint_escape", "path_traversal", "code_injection"] },
16035
- { method: "parseFloat", removes: ["sql_injection", "nosql_injection", "command_injection", "external_taint_escape", "path_traversal", "code_injection"] },
16036
- { method: "Number", removes: ["sql_injection", "nosql_injection", "command_injection", "external_taint_escape", "path_traversal", "code_injection"] },
16224
+ // #1305 E2: a number has no CR/LF, so it cannot split or forge a log entry: log_injection too.
16225
+ // (Still not size-sensitive consumers: a parsed number is attacker-chosen.)
16226
+ { method: "parseInt", removes: ["sql_injection", "nosql_injection", "command_injection", "xss", "external_taint_escape", "path_traversal", "code_injection", "log_injection"] },
16227
+ { method: "parseFloat", removes: ["sql_injection", "nosql_injection", "command_injection", "external_taint_escape", "path_traversal", "code_injection", "log_injection"] },
16228
+ { method: "Number", removes: ["sql_injection", "nosql_injection", "command_injection", "external_taint_escape", "path_traversal", "code_injection", "log_injection"] },
16037
16229
  // Sprint 29 (#113): bounds-clamp Math.min / Math.max — when used to bound
16038
16230
  // a numeric/size value (e.g. `Math.min(size, MAX_BYTES)`), the result is
16039
16231
  // safely bounded and cannot resource-exhaust downstream. Only suppress
@@ -16061,6 +16253,8 @@ var DEFAULT_SANITIZERS = [
16061
16253
  // SQL - parameterized queries (mysql, pg)
16062
16254
  { method: "escape", class: "mysql", removes: ["sql_injection"] },
16063
16255
  { method: "escapeId", class: "mysql", removes: ["sql_injection"] },
16256
+ // BenchProctor express_ts safe ORDER BY (cognium-dev#1332): escapeIdentifier wrapper before concat query
16257
+ { method: "escapeIdentifier", removes: ["sql_injection", "external_taint_escape"] },
16064
16258
  { method: "format", class: "mysql", removes: ["sql_injection"] },
16065
16259
  // MongoDB - sanitization
16066
16260
  { method: "sanitize", class: "mongo", removes: ["nosql_injection"] },
@@ -16305,7 +16499,7 @@ var DEFAULT_SANITIZERS = [
16305
16499
  // Java UUID parse — UUID.fromString rejects non-UUID strings
16306
16500
  { method: "fromString", class: "UUID", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
16307
16501
  // JavaScript numeric coercion (Number/parseInt/parseFloat already covered above; add path_traversal/code_injection)
16308
- { method: "BigInt", removes: ["sql_injection", "nosql_injection", "command_injection", "path_traversal", "code_injection"] },
16502
+ { method: "BigInt", removes: ["sql_injection", "nosql_injection", "command_injection", "path_traversal", "code_injection", "log_injection"] },
16309
16503
  // Go numeric parse — strconv.Atoi, ParseInt, ParseFloat, ParseUint, ParseBool
16310
16504
  { method: "Atoi", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
16311
16505
  { method: "ParseInt", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
@@ -16382,6 +16576,12 @@ var DEFAULT_SINK_SEMANTICS = [
16382
16576
  real_class: "jdk_internal",
16383
16577
  overrides: ["code_injection"],
16384
16578
  note: "java.lang.invoke.MethodHandle \u2014 JDK-internal"
16579
+ },
16580
+ {
16581
+ signature: "Class#forName",
16582
+ real_class: "jdk_reflection",
16583
+ overrides: ["deserialization"],
16584
+ note: "User-controlled Class.forName is CWE-94 code_injection; drop CWE-502 duplicate (#1349)"
16385
16585
  }
16386
16586
  ];
16387
16587
  function getDefaultConfig() {
@@ -17482,6 +17682,7 @@ function isSafeJSChildProcessCall(call, pattern, language) {
17482
17682
  if (m !== "spawn" && m !== "spawnSync" && m !== "execFile" && m !== "execFileSync") return false;
17483
17683
  const programArg = call.arguments.find((a) => a.position === 0);
17484
17684
  if (!programArg) return false;
17685
+ if (call.arguments.some((a) => SHELL_OPTION_ON.test(a.expression ?? ""))) return false;
17485
17686
  let program;
17486
17687
  if (programArg.literal !== null && programArg.literal !== void 0) {
17487
17688
  program = String(programArg.literal).split("/").pop() ?? String(programArg.literal);
@@ -17490,6 +17691,7 @@ function isSafeJSChildProcessCall(call, pattern, language) {
17490
17691
  if (!(expr.startsWith('"') || expr.startsWith("`") || expr.startsWith("'"))) {
17491
17692
  return false;
17492
17693
  }
17694
+ if (expr.startsWith("`") && expr.includes("${")) return false;
17493
17695
  const stripped = expr.slice(1, -1);
17494
17696
  program = stripped.split("/").pop() ?? stripped;
17495
17697
  }
@@ -17898,6 +18100,10 @@ function isTypedNonDbReceiver(receiver, sourceLines) {
17898
18100
  }
17899
18101
  return typed !== void 0 && !DB_TYPE_NAME.test(typed) && !/^(?:any|unknown|object)$/.test(typed);
17900
18102
  }
18103
+ var REQUEST_OBJECT_RECEIVERS = /* @__PURE__ */ new Set(["req", "request", "c.req", "ctx.req", "ctx.request", "this.req"]);
18104
+ function isRequestObjectReceiver(receiver) {
18105
+ return REQUEST_OBJECT_RECEIVERS.has((receiver ?? "").trim());
18106
+ }
17901
18107
  function isNavigationReceiverName(receiver) {
17902
18108
  const r = (receiver ?? "").trim();
17903
18109
  if (!r) return false;
@@ -17943,14 +18149,15 @@ function isJsMapTypedReceiver(receiver, sourceLines) {
17943
18149
  const raw = (receiver ?? "").trim();
17944
18150
  if (!raw || !sourceLines) return false;
17945
18151
  const lastDot = raw.lastIndexOf(".");
17946
- const r = (lastDot >= 0 ? raw.slice(lastDot + 1) : raw).trim();
18152
+ let r = (lastDot >= 0 ? raw.slice(lastDot + 1) : raw).trim();
18153
+ if (r.startsWith("#")) r = r.slice(1);
17947
18154
  if (!/^[A-Za-z_$][\w$]*$/.test(r)) return false;
17948
18155
  const n = escapeRe(r);
17949
18156
  const mapCtor = new RegExp(
17950
- `\\b${n}\\s*(?::[^=;]*)?=\\s*new\\s+(?:Weak)?Map\\s*(?:<.*>)?\\s*\\(`
18157
+ `\\b#?${n}\\s*(?::[^=;]*)?=\\s*new\\s+(?:Weak)?Map\\s*(?:<.*>)?\\s*\\(`
17951
18158
  );
17952
18159
  const mapType = new RegExp(
17953
- `\\b${n}\\s*\\??\\s*:\\s*(?:Readonly)?(?:Weak)?Map\\s*<`
18160
+ `\\b#?${n}\\s*\\??\\s*:\\s*(?:Readonly)?(?:Weak)?Map\\s*<`
17954
18161
  );
17955
18162
  return sourceLines.some((l) => mapCtor.test(l) || mapType.test(l));
17956
18163
  }
@@ -17959,7 +18166,8 @@ function isInMemoryMapGetReceiver(receiver, sourceLines) {
17959
18166
  if (!raw || !sourceLines) return false;
17960
18167
  if (/\.properties$/i.test(raw)) return true;
17961
18168
  const lastDot = raw.lastIndexOf(".");
17962
- const r = (lastDot >= 0 ? raw.slice(lastDot + 1) : raw).trim();
18169
+ let r = (lastDot >= 0 ? raw.slice(lastDot + 1) : raw).trim();
18170
+ if (r.startsWith("#")) r = r.slice(1);
17963
18171
  if (/^(properties|memoryCache)$/i.test(r)) return true;
17964
18172
  return isJsMapTypedReceiver(receiver, sourceLines);
17965
18173
  }
@@ -18254,6 +18462,9 @@ function findSinks(calls, patterns, typeHierarchy, language, sourceLines, types)
18254
18462
  if ((pattern.type === "command_injection" || pattern.type === "sql_injection") && call.method_name === "exec" && (language === "javascript" || language === "typescript") && isRegexReceiver(call.receiver, sourceLines)) {
18255
18463
  continue;
18256
18464
  }
18465
+ if (pattern.type === "sql_injection" && call.method_name === "query" && (language === "javascript" || language === "typescript") && isRequestObjectReceiver(call.receiver)) {
18466
+ continue;
18467
+ }
18257
18468
  if (pattern.type === "sql_injection" && call.method_name === "get" && pattern.class === "Connection" && (language === "javascript" || language === "typescript") && (isInMemoryMapGetReceiver(call.receiver, sourceLines) || isTypedNonDbReceiver(call.receiver, sourceLines))) {
18258
18469
  continue;
18259
18470
  }
@@ -18322,6 +18533,8 @@ function matchesSourcePattern(call, pattern, language, types, imports) {
18322
18533
  return false;
18323
18534
  }
18324
18535
  } else if (language === "java" && types && imports && call.receiver && pattern.class && javaWikiTagInheritedContextReceiver(call.receiver, pattern.class, call, types, imports)) {
18536
+ } else if (language === "java" && pattern.type === "db_input" && pattern.class === "ResultSet" && call.receiver_type && call.receiver_type !== "var" && !/(?:ResultSet|RowSet)$/.test(call.receiver_type)) {
18537
+ return false;
18325
18538
  } else if (!receiverMightBeClass(call.receiver, pattern.class)) {
18326
18539
  return false;
18327
18540
  }
@@ -18504,6 +18717,8 @@ var SAFE_RECEIVERS_BY_METHOD = {
18504
18717
  "saml",
18505
18718
  "oidc"
18506
18719
  ]),
18720
+ // ES template tag `String.raw` — not SQL (Knex/Objection `.raw(sql)` keeps sinking).
18721
+ raw: /* @__PURE__ */ new Set(["string"]),
18507
18722
  // add() is extremely generic — safe on collections, UI containers, builders, etc.
18508
18723
  add: /* @__PURE__ */ new Set([
18509
18724
  "list",
@@ -19205,6 +19420,23 @@ function findSanitizers(calls, types, patterns, sourceLines, language) {
19205
19420
  sanitizes: removes
19206
19421
  });
19207
19422
  }
19423
+ if (sourceLines && (language === "javascript" || language === "typescript" || language === "tsx")) {
19424
+ const numericRemoves = patterns.find((p) => p.method === "Number" && !p.class)?.removes ?? [];
19425
+ const jsCode = sourceLines.join("\n");
19426
+ const numericHelper = /* @__PURE__ */ new Map();
19427
+ for (const call of calls) {
19428
+ if (call.receiver || wrapperSanitizers.has(call.method_name) || numericRemoves.length === 0) continue;
19429
+ let numeric = numericHelper.get(call.method_name);
19430
+ if (numeric === void 0) numericHelper.set(call.method_name, numeric = jsHelperReturnsNumber(jsCode, call.method_name));
19431
+ if (!numeric) continue;
19432
+ sanitizers.push({
19433
+ type: "derived_wrapper",
19434
+ method: formatSanitizerMethod(call),
19435
+ line: call.location.line,
19436
+ sanitizes: [...numericRemoves]
19437
+ });
19438
+ }
19439
+ }
19208
19440
  const noopLocalHelpers = !sourceLines ? /* @__PURE__ */ new Set() : language === "java" ? findJavaNoopHelpers(types, sourceLines) : language === "python" ? findPythonNoopHelpers(types, sourceLines) : language === "go" ? findGoNoopHelpers(types, sourceLines) : language === "javascript" || language === "typescript" || language === "tsx" ? findJsNoopHelpers(types, sourceLines) : /* @__PURE__ */ new Set();
19209
19441
  for (const call of calls) {
19210
19442
  if (sanitizerMethods.has(call.method_name)) {
@@ -19300,7 +19532,7 @@ function findPythonNoopHelpers(types, sourceLines) {
19300
19532
  function isPythonNoopBody(method, sourceLines) {
19301
19533
  if (method.parameters.length === 0) return false;
19302
19534
  const text = sourceLines.slice(method.start_line - 1, method.end_line).join("\n");
19303
- const header = /^\s*(?:async\s+)?def\s+\w+\s*\(([^()]*)\)\s*(?:->\s*[\w.\[\], ]+)?\s*:/.exec(text);
19535
+ const header = /^\s*(?:async\s+)?def\s+\w+\s*\(([^()]*)\)\s*(?:->\s*[\w.\[\],](?:[\w.\[\], ]*[\w.\[\],])?\s*)?:/.exec(text);
19304
19536
  if (!header) return false;
19305
19537
  const body2 = text.slice(header[0].length).replace(/#.*$/gm, "").trim();
19306
19538
  const m = /^return\s+([^\n;]+)$/.exec(body2);
@@ -19329,7 +19561,7 @@ function findGoNoopHelpers(types, sourceLines) {
19329
19561
  function isGoNoopBody(method, sourceLines) {
19330
19562
  if (method.parameters.length === 0) return false;
19331
19563
  const text = sourceLines.slice(method.start_line - 1, method.end_line).join("\n");
19332
- const header = /^\s*func\s+\w+\s*\(([^()]*)\)\s*\(?[\w.\[\]*, ]*\)?\s*\{/.exec(text);
19564
+ const header = /^\s*func\s+\w+\s*\(([^()]*)\)\s*(?:(?:\([\w.\[\]*, ]*\)|[\w.\[\]*,](?:[\w.\[\]*, ]*[\w.\[\]*,])?)\s*)?\{/.exec(text);
19333
19565
  if (!header) return false;
19334
19566
  const close = text.lastIndexOf("}");
19335
19567
  if (close < header[0].length) return false;
@@ -19506,6 +19738,7 @@ var CodeGraph = class {
19506
19738
  * `re.MatchString(x)`) (#568)
19507
19739
  * - a lookup in a constant table the file never writes (`T[req.query.k]`)
19508
19740
  * (#667)
19741
+ * - a read of Hono bindings, `c.env` or a member below it
19509
19742
  */
19510
19743
  taintBarrierDefIds = /* @__PURE__ */ new Set();
19511
19744
  constructor(ir) {
@@ -20012,6 +20245,43 @@ function propagateTaint(graphOrDfg, callsOrSources, sourcesOrSinks, sinksOrSanit
20012
20245
  return { taintedVars, flows: deduped, reachableSinks };
20013
20246
  }
20014
20247
  var PARAM_SCOPED_SOURCE_RE = /^(?:GraphQL \w+\.\w+ resolver args|Express handler destructured request) /;
20248
+ var IDENT_START = /[A-Za-z_$]/;
20249
+ var IDENT_PART = /[\w$]/;
20250
+ var WORD_CHAR = /\w/;
20251
+ var isSpace = (ch) => ch.trim() === "";
20252
+ function calledMethodInLocation(location) {
20253
+ for (let at = location.indexOf("()"); at >= 0; at = location.indexOf("()", at + 1)) {
20254
+ const after = at + 2;
20255
+ if (after < location.length) {
20256
+ let w = after;
20257
+ while (w < location.length && isSpace(location[w])) w++;
20258
+ if (w === after || location.slice(w, w + 2) !== "in" || WORD_CHAR.test(location[w + 2] ?? "")) continue;
20259
+ }
20260
+ let end = at;
20261
+ while (end > 0 && isSpace(location[end - 1])) end--;
20262
+ let start2 = end;
20263
+ while (start2 > 0 && IDENT_PART.test(location[start2 - 1])) start2--;
20264
+ while (start2 < end && !IDENT_START.test(location[start2])) start2++;
20265
+ if (start2 < end) return location.slice(start2, end);
20266
+ }
20267
+ return void 0;
20268
+ }
20269
+ function paramsConsumedBySourceCall(source, defsOnLine, calls) {
20270
+ if (source.type === "interprocedural_param" || !calls) return null;
20271
+ const method = source.method ?? calledMethodInLocation(source.location ?? "");
20272
+ if (!method) return null;
20273
+ const params = defsOnLine.filter((d) => d.kind === "param" && /^[A-Za-z_$][\w$]*$/.test(d.variable));
20274
+ if (params.length === 0) return null;
20275
+ const out2 = /* @__PURE__ */ new Set();
20276
+ for (const call of calls) {
20277
+ if (call.method_name !== method) continue;
20278
+ for (const p of params) {
20279
+ const re = new RegExp(String.raw`(?<![.\w$])${p.variable.replace(/\$/g, "\\$")}(?![\w$])`);
20280
+ if (call.arguments.some((a) => re.test(a.expression))) out2.add(p.variable);
20281
+ }
20282
+ }
20283
+ return out2.size > 0 ? out2 : null;
20284
+ }
20015
20285
  function isCompleteConditionHeader(code) {
20016
20286
  if (!code) return false;
20017
20287
  const m = /^(?:\}\s*)?(?:else\s+)?(?:if|while)\s*\(/.exec(code);
@@ -20065,6 +20335,12 @@ function lineDefinitionLacksUse(lineCode, variable, via) {
20065
20335
  const rhs = lineCode.slice(m.index + m[0].length, end);
20066
20336
  return !new RegExp(String.raw`(?<![.\w$])${via.replace(/\$/g, "\\$")}(?![\w$])`).test(rhs);
20067
20337
  }
20338
+ function catchBindingNames(code) {
20339
+ const m = code ? /^(?:\}\s*)?catch\s*\(([^)]*)\)/.exec(code) : null;
20340
+ if (!m) return /* @__PURE__ */ new Set();
20341
+ const binding = /^\s*[{[]/.test(m[1]) ? m[1] : m[1].split(":")[0];
20342
+ return new Set(binding.match(/[A-Za-z_$][\w$]*/g) ?? []);
20343
+ }
20068
20344
  function findInitialTaint(sources, callsByLine, defsByLine, chainsByFromDef, jsLike = false, lineText) {
20069
20345
  const tainted = [];
20070
20346
  for (const source of sources) {
@@ -20085,8 +20361,10 @@ function findInitialTaint(sources, callsByLine, defsByLine, chainsByFromDef, jsL
20085
20361
  }
20086
20362
  }
20087
20363
  }
20364
+ const consumedParams = jsLike ? paramsConsumedBySourceCall(source, defsOnLine, callsByLine.get(source.line)) : null;
20088
20365
  for (const def of defsOnLine) {
20089
20366
  if (seedable && !seedable.has(def.id)) continue;
20367
+ if (consumedParams?.has(def.variable)) continue;
20090
20368
  if ((source.type === "interprocedural_param" || PARAM_SCOPED_SOURCE_RE.test(source.location ?? "")) && source.variable && def.kind === "param" && def.variable !== source.variable) {
20091
20369
  continue;
20092
20370
  }
@@ -20107,7 +20385,9 @@ function findInitialTaint(sources, callsByLine, defsByLine, chainsByFromDef, jsL
20107
20385
  const nextCode = lineText && !source.variable ? lineText(source.line + 1)?.trim() : void 0;
20108
20386
  const nextMulti = !!nextCode && hasSecondStatement(nextCode);
20109
20387
  const sourceLineNames = [...new Set(defsOnLine.map((d) => d.variable))];
20388
+ const nextCatchNames = jsLike ? catchBindingNames(lineText?.(source.line + 1)?.trim()) : null;
20110
20389
  for (const def of defsNextLine) {
20390
+ if (nextCatchNames?.has(def.variable)) continue;
20111
20391
  const callsOnSourceLine = callsByLine.get(source.line) ?? [];
20112
20392
  if (callsOnSourceLine.length > 0) {
20113
20393
  if (source.variable && def.variable !== source.variable) continue;