circle-ir 4.17.0 → 4.19.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 (288) hide show
  1. package/dist/analysis/advisories.d.ts +186 -0
  2. package/dist/analysis/advisories.d.ts.map +1 -0
  3. package/dist/analysis/advisories.js +391 -0
  4. package/dist/analysis/advisories.js.map +1 -0
  5. package/dist/analysis/comment-lines.d.ts +14 -0
  6. package/dist/analysis/comment-lines.d.ts.map +1 -0
  7. package/dist/analysis/comment-lines.js +34 -0
  8. package/dist/analysis/comment-lines.js.map +1 -0
  9. package/dist/analysis/config-loader.d.ts.map +1 -1
  10. package/dist/analysis/config-loader.js +81 -27
  11. package/dist/analysis/config-loader.js.map +1 -1
  12. package/dist/analysis/constant-caller-gate.d.ts +2 -2
  13. package/dist/analysis/constant-caller-gate.d.ts.map +1 -1
  14. package/dist/analysis/constant-caller-gate.js +205 -29
  15. package/dist/analysis/constant-caller-gate.js.map +1 -1
  16. package/dist/analysis/constant-propagation/propagator.d.ts +4 -0
  17. package/dist/analysis/constant-propagation/propagator.d.ts.map +1 -1
  18. package/dist/analysis/constant-propagation/propagator.js +99 -0
  19. package/dist/analysis/constant-propagation/propagator.js.map +1 -1
  20. package/dist/analysis/entry-point-detection.d.ts.map +1 -1
  21. package/dist/analysis/entry-point-detection.js +72 -0
  22. package/dist/analysis/entry-point-detection.js.map +1 -1
  23. package/dist/analysis/interprocedural.d.ts +6 -0
  24. package/dist/analysis/interprocedural.d.ts.map +1 -1
  25. package/dist/analysis/interprocedural.js +124 -10
  26. package/dist/analysis/interprocedural.js.map +1 -1
  27. package/dist/analysis/js-helper-return.d.ts +12 -0
  28. package/dist/analysis/js-helper-return.d.ts.map +1 -0
  29. package/dist/analysis/js-helper-return.js +64 -0
  30. package/dist/analysis/js-helper-return.js.map +1 -0
  31. package/dist/analysis/maven-declared.d.ts +72 -0
  32. package/dist/analysis/maven-declared.d.ts.map +1 -0
  33. package/dist/analysis/maven-declared.js +216 -0
  34. package/dist/analysis/maven-declared.js.map +1 -0
  35. package/dist/analysis/maven-version.d.ts +28 -0
  36. package/dist/analysis/maven-version.d.ts.map +1 -0
  37. package/dist/analysis/maven-version.js +172 -0
  38. package/dist/analysis/maven-version.js.map +1 -0
  39. package/dist/analysis/passes/constant-propagation-pass.d.ts.map +1 -1
  40. package/dist/analysis/passes/constant-propagation-pass.js +29 -1
  41. package/dist/analysis/passes/constant-propagation-pass.js.map +1 -1
  42. package/dist/analysis/passes/cross-file-pass.d.ts.map +1 -1
  43. package/dist/analysis/passes/cross-file-pass.js +81 -1
  44. package/dist/analysis/passes/cross-file-pass.js.map +1 -1
  45. package/dist/analysis/passes/csharp-sanitizer-credit.d.ts +7 -0
  46. package/dist/analysis/passes/csharp-sanitizer-credit.d.ts.map +1 -1
  47. package/dist/analysis/passes/csharp-sanitizer-credit.js +44 -1
  48. package/dist/analysis/passes/csharp-sanitizer-credit.js.map +1 -1
  49. package/dist/analysis/passes/insecure-cookie-pass.d.ts +2 -0
  50. package/dist/analysis/passes/insecure-cookie-pass.d.ts.map +1 -1
  51. package/dist/analysis/passes/insecure-cookie-pass.js +25 -3
  52. package/dist/analysis/passes/insecure-cookie-pass.js.map +1 -1
  53. package/dist/analysis/passes/interprocedural-pass.d.ts +11 -14
  54. package/dist/analysis/passes/interprocedural-pass.d.ts.map +1 -1
  55. package/dist/analysis/passes/interprocedural-pass.js +564 -0
  56. package/dist/analysis/passes/interprocedural-pass.js.map +1 -1
  57. package/dist/analysis/passes/language-sources-pass.d.ts +18 -1
  58. package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
  59. package/dist/analysis/passes/language-sources-pass.js +1097 -15
  60. package/dist/analysis/passes/language-sources-pass.js.map +1 -1
  61. package/dist/analysis/passes/param-source-flow-gate-pass.d.ts.map +1 -1
  62. package/dist/analysis/passes/param-source-flow-gate-pass.js +66 -3
  63. package/dist/analysis/passes/param-source-flow-gate-pass.js.map +1 -1
  64. package/dist/analysis/passes/resource-leak-pass.d.ts.map +1 -1
  65. package/dist/analysis/passes/resource-leak-pass.js +5 -1
  66. package/dist/analysis/passes/resource-leak-pass.js.map +1 -1
  67. package/dist/analysis/passes/sink-filter-pass.d.ts +44 -2
  68. package/dist/analysis/passes/sink-filter-pass.d.ts.map +1 -1
  69. package/dist/analysis/passes/sink-filter-pass.js +728 -13
  70. package/dist/analysis/passes/sink-filter-pass.js.map +1 -1
  71. package/dist/analysis/passes/taint-propagation-pass.d.ts.map +1 -1
  72. package/dist/analysis/passes/taint-propagation-pass.js +133 -10
  73. package/dist/analysis/passes/taint-propagation-pass.js.map +1 -1
  74. package/dist/analysis/passes/tls-verify-disabled-pass.d.ts +18 -0
  75. package/dist/analysis/passes/tls-verify-disabled-pass.d.ts.map +1 -1
  76. package/dist/analysis/passes/tls-verify-disabled-pass.js +161 -0
  77. package/dist/analysis/passes/tls-verify-disabled-pass.js.map +1 -1
  78. package/dist/analysis/passes/weak-random-pass.d.ts +6 -0
  79. package/dist/analysis/passes/weak-random-pass.d.ts.map +1 -1
  80. package/dist/analysis/passes/weak-random-pass.js +29 -0
  81. package/dist/analysis/passes/weak-random-pass.js.map +1 -1
  82. package/dist/analysis/promote-cross-file-flows.d.ts +17 -0
  83. package/dist/analysis/promote-cross-file-flows.d.ts.map +1 -0
  84. package/dist/analysis/promote-cross-file-flows.js +32 -0
  85. package/dist/analysis/promote-cross-file-flows.js.map +1 -0
  86. package/dist/analysis/sbom.d.ts +100 -0
  87. package/dist/analysis/sbom.d.ts.map +1 -1
  88. package/dist/analysis/sbom.js +514 -3
  89. package/dist/analysis/sbom.js.map +1 -1
  90. package/dist/analysis/semver-version.d.ts +30 -0
  91. package/dist/analysis/semver-version.d.ts.map +1 -0
  92. package/dist/analysis/semver-version.js +76 -0
  93. package/dist/analysis/semver-version.js.map +1 -0
  94. package/dist/analysis/taint-matcher.d.ts +5 -0
  95. package/dist/analysis/taint-matcher.d.ts.map +1 -1
  96. package/dist/analysis/taint-matcher.js +293 -6
  97. package/dist/analysis/taint-matcher.js.map +1 -1
  98. package/dist/analyzer.d.ts +57 -0
  99. package/dist/analyzer.d.ts.map +1 -1
  100. package/dist/analyzer.js +69 -6
  101. package/dist/analyzer.js.map +1 -1
  102. package/dist/browser/circle-ir.js +3156 -323
  103. package/dist/core/circle-ir-core.cjs +951 -409
  104. package/dist/core/circle-ir-core.js +951 -409
  105. package/dist/core/extractors/dfg.js +244 -2
  106. package/dist/core/extractors/dfg.js.map +1 -1
  107. package/dist/core/extractors/ts-declaration-detail.d.ts +39 -0
  108. package/dist/core/extractors/ts-declaration-detail.d.ts.map +1 -0
  109. package/dist/core/extractors/ts-declaration-detail.js +266 -0
  110. package/dist/core/extractors/ts-declaration-detail.js.map +1 -0
  111. package/dist/graph/analysis-pass.d.ts +4 -1
  112. package/dist/graph/analysis-pass.d.ts.map +1 -1
  113. package/dist/graph/analysis-pass.js +4 -1
  114. package/dist/graph/analysis-pass.js.map +1 -1
  115. package/dist/graph-facts/dead-code.d.ts +62 -0
  116. package/dist/graph-facts/dead-code.d.ts.map +1 -0
  117. package/dist/graph-facts/dead-code.js +90 -0
  118. package/dist/graph-facts/dead-code.js.map +1 -0
  119. package/dist/graph-facts/dependency-calls.d.ts +86 -0
  120. package/dist/graph-facts/dependency-calls.d.ts.map +1 -0
  121. package/dist/graph-facts/dependency-calls.js +93 -0
  122. package/dist/graph-facts/dependency-calls.js.map +1 -0
  123. package/dist/graph-facts/index.d.ts +10 -0
  124. package/dist/graph-facts/index.d.ts.map +1 -0
  125. package/dist/graph-facts/index.js +10 -0
  126. package/dist/graph-facts/index.js.map +1 -0
  127. package/dist/graph-facts/maven-packages.d.ts +42 -0
  128. package/dist/graph-facts/maven-packages.d.ts.map +1 -0
  129. package/dist/graph-facts/maven-packages.js +133 -0
  130. package/dist/graph-facts/maven-packages.js.map +1 -0
  131. package/dist/graph-facts/reach.d.ts +203 -0
  132. package/dist/graph-facts/reach.d.ts.map +1 -0
  133. package/dist/graph-facts/reach.js +219 -0
  134. package/dist/graph-facts/reach.js.map +1 -0
  135. package/dist/graph-facts/removal-reach.d.ts +73 -0
  136. package/dist/graph-facts/removal-reach.d.ts.map +1 -0
  137. package/dist/graph-facts/removal-reach.js +64 -0
  138. package/dist/graph-facts/removal-reach.js.map +1 -0
  139. package/dist/index.d.ts +21 -6
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js +20 -3
  142. package/dist/index.js.map +1 -1
  143. package/dist/navigation/go-graph.d.ts +68 -0
  144. package/dist/navigation/go-graph.d.ts.map +1 -0
  145. package/dist/navigation/go-graph.js +753 -0
  146. package/dist/navigation/go-graph.js.map +1 -0
  147. package/dist/navigation/index.d.ts +7 -1
  148. package/dist/navigation/index.d.ts.map +1 -1
  149. package/dist/navigation/index.js +6 -0
  150. package/dist/navigation/index.js.map +1 -1
  151. package/dist/navigation/java-entry-tables.d.ts +43 -0
  152. package/dist/navigation/java-entry-tables.d.ts.map +1 -0
  153. package/dist/navigation/java-entry-tables.js +56 -0
  154. package/dist/navigation/java-entry-tables.js.map +1 -0
  155. package/dist/navigation/java-graph.d.ts +64 -0
  156. package/dist/navigation/java-graph.d.ts.map +1 -0
  157. package/dist/navigation/java-graph.js +466 -0
  158. package/dist/navigation/java-graph.js.map +1 -0
  159. package/dist/navigation/navigation-index.d.ts +51 -1
  160. package/dist/navigation/navigation-index.d.ts.map +1 -1
  161. package/dist/navigation/navigation-index.js +72 -0
  162. package/dist/navigation/navigation-index.js.map +1 -1
  163. package/dist/navigation/python-graph.d.ts +73 -0
  164. package/dist/navigation/python-graph.d.ts.map +1 -0
  165. package/dist/navigation/python-graph.js +867 -0
  166. package/dist/navigation/python-graph.js.map +1 -0
  167. package/dist/navigation/ts-call-edges.d.ts +193 -0
  168. package/dist/navigation/ts-call-edges.d.ts.map +1 -0
  169. package/dist/navigation/ts-call-edges.js +2089 -0
  170. package/dist/navigation/ts-call-edges.js.map +1 -0
  171. package/dist/navigation/ts-entry-tables.d.ts +88 -0
  172. package/dist/navigation/ts-entry-tables.d.ts.map +1 -0
  173. package/dist/navigation/ts-entry-tables.js +50 -0
  174. package/dist/navigation/ts-entry-tables.js.map +1 -0
  175. package/dist/path-set/branches.d.ts +52 -0
  176. package/dist/path-set/branches.d.ts.map +1 -0
  177. package/dist/path-set/branches.js +124 -0
  178. package/dist/path-set/branches.js.map +1 -0
  179. package/dist/path-set/finding-diff.d.ts +63 -0
  180. package/dist/path-set/finding-diff.d.ts.map +1 -0
  181. package/dist/path-set/finding-diff.js +150 -0
  182. package/dist/path-set/finding-diff.js.map +1 -0
  183. package/dist/path-set/index.d.ts +18 -0
  184. package/dist/path-set/index.d.ts.map +1 -0
  185. package/dist/path-set/index.js +12 -0
  186. package/dist/path-set/index.js.map +1 -0
  187. package/dist/path-set/line-diff.d.ts +19 -0
  188. package/dist/path-set/line-diff.d.ts.map +1 -0
  189. package/dist/path-set/line-diff.js +98 -0
  190. package/dist/path-set/line-diff.js.map +1 -0
  191. package/dist/path-set/path-set.d.ts +88 -0
  192. package/dist/path-set/path-set.d.ts.map +1 -0
  193. package/dist/path-set/path-set.js +716 -0
  194. package/dist/path-set/path-set.js.map +1 -0
  195. package/dist/path-set/templates.d.ts +42 -0
  196. package/dist/path-set/templates.d.ts.map +1 -0
  197. package/dist/path-set/templates.js +119 -0
  198. package/dist/path-set/templates.js.map +1 -0
  199. package/dist/path-set/types.d.ts +195 -0
  200. package/dist/path-set/types.d.ts.map +1 -0
  201. package/dist/path-set/types.js +8 -0
  202. package/dist/path-set/types.js.map +1 -0
  203. package/dist/remedy-class/index.d.ts +12 -0
  204. package/dist/remedy-class/index.d.ts.map +1 -0
  205. package/dist/remedy-class/index.js +9 -0
  206. package/dist/remedy-class/index.js.map +1 -0
  207. package/dist/remedy-class/match.d.ts +165 -0
  208. package/dist/remedy-class/match.d.ts.map +1 -0
  209. package/dist/remedy-class/match.js +705 -0
  210. package/dist/remedy-class/match.js.map +1 -0
  211. package/dist/remedy-class/output-context.d.ts +25 -0
  212. package/dist/remedy-class/output-context.d.ts.map +1 -0
  213. package/dist/remedy-class/output-context.js +150 -0
  214. package/dist/remedy-class/output-context.js.map +1 -0
  215. package/dist/remedy-class/sha256.d.ts +18 -0
  216. package/dist/remedy-class/sha256.d.ts.map +1 -0
  217. package/dist/remedy-class/sha256.js +89 -0
  218. package/dist/remedy-class/sha256.js.map +1 -0
  219. package/dist/remedy-class/table.d.ts +130 -0
  220. package/dist/remedy-class/table.d.ts.map +1 -0
  221. package/dist/remedy-class/table.js +457 -0
  222. package/dist/remedy-class/table.js.map +1 -0
  223. package/dist/resolution/cross-file.d.ts +11 -0
  224. package/dist/resolution/cross-file.d.ts.map +1 -1
  225. package/dist/resolution/cross-file.js +82 -5
  226. package/dist/resolution/cross-file.js.map +1 -1
  227. package/dist/stable-ids/builder.d.ts +20 -0
  228. package/dist/stable-ids/builder.d.ts.map +1 -0
  229. package/dist/stable-ids/builder.js +65 -0
  230. package/dist/stable-ids/builder.js.map +1 -0
  231. package/dist/stable-ids/diff.d.ts +18 -0
  232. package/dist/stable-ids/diff.d.ts.map +1 -0
  233. package/dist/stable-ids/diff.js +37 -0
  234. package/dist/stable-ids/diff.js.map +1 -0
  235. package/dist/stable-ids/go.d.ts +28 -0
  236. package/dist/stable-ids/go.d.ts.map +1 -0
  237. package/dist/stable-ids/go.js +160 -0
  238. package/dist/stable-ids/go.js.map +1 -0
  239. package/dist/stable-ids/hash.d.ts +22 -0
  240. package/dist/stable-ids/hash.d.ts.map +1 -0
  241. package/dist/stable-ids/hash.js +167 -0
  242. package/dist/stable-ids/hash.js.map +1 -0
  243. package/dist/stable-ids/index.d.ts +30 -0
  244. package/dist/stable-ids/index.d.ts.map +1 -0
  245. package/dist/stable-ids/index.js +59 -0
  246. package/dist/stable-ids/index.js.map +1 -0
  247. package/dist/stable-ids/java.d.ts +28 -0
  248. package/dist/stable-ids/java.d.ts.map +1 -0
  249. package/dist/stable-ids/java.js +224 -0
  250. package/dist/stable-ids/java.js.map +1 -0
  251. package/dist/stable-ids/moves.d.ts +87 -0
  252. package/dist/stable-ids/moves.d.ts.map +1 -0
  253. package/dist/stable-ids/moves.js +222 -0
  254. package/dist/stable-ids/moves.js.map +1 -0
  255. package/dist/stable-ids/nodes.d.ts +32 -0
  256. package/dist/stable-ids/nodes.d.ts.map +1 -0
  257. package/dist/stable-ids/nodes.js +92 -0
  258. package/dist/stable-ids/nodes.js.map +1 -0
  259. package/dist/stable-ids/normalize.d.ts +35 -0
  260. package/dist/stable-ids/normalize.d.ts.map +1 -0
  261. package/dist/stable-ids/normalize.js +174 -0
  262. package/dist/stable-ids/normalize.js.map +1 -0
  263. package/dist/stable-ids/parse-errors.d.ts +24 -0
  264. package/dist/stable-ids/parse-errors.d.ts.map +1 -0
  265. package/dist/stable-ids/parse-errors.js +46 -0
  266. package/dist/stable-ids/parse-errors.js.map +1 -0
  267. package/dist/stable-ids/python.d.ts +27 -0
  268. package/dist/stable-ids/python.d.ts.map +1 -0
  269. package/dist/stable-ids/python.js +212 -0
  270. package/dist/stable-ids/python.js.map +1 -0
  271. package/dist/stable-ids/ts-parse-errors.d.ts +27 -0
  272. package/dist/stable-ids/ts-parse-errors.d.ts.map +1 -0
  273. package/dist/stable-ids/ts-parse-errors.js +75 -0
  274. package/dist/stable-ids/ts-parse-errors.js.map +1 -0
  275. package/dist/stable-ids/types.d.ts +106 -0
  276. package/dist/stable-ids/types.d.ts.map +1 -0
  277. package/dist/stable-ids/types.js +16 -0
  278. package/dist/stable-ids/types.js.map +1 -0
  279. package/dist/stable-ids/typescript.d.ts +30 -0
  280. package/dist/stable-ids/typescript.d.ts.map +1 -0
  281. package/dist/stable-ids/typescript.js +362 -0
  282. package/dist/stable-ids/typescript.js.map +1 -0
  283. package/dist/types/config.d.ts +9 -0
  284. package/dist/types/config.d.ts.map +1 -1
  285. package/dist/types/index.d.ts +35 -0
  286. package/dist/types/index.d.ts.map +1 -1
  287. package/dist/types/index.js.map +1 -1
  288. package/package.json +3 -3
@@ -10456,6 +10456,116 @@ function processStatement2(stmt, startDefId, startUseId, scopeStack, isJavaScrip
10456
10456
  carryBranchDefsOut(popped, scopeStack, alwaysRuns);
10457
10457
  break;
10458
10458
  }
10459
+ case "try_statement":
10460
+ case "try_with_resources_statement": {
10461
+ if (isJavaScript) {
10462
+ const tryBody = stmt.childForFieldName("body");
10463
+ if (tryBody) {
10464
+ const r = processStatement2(tryBody, defId, useId, scopeStack, isJavaScript);
10465
+ defs.push(...r.defs);
10466
+ uses.push(...r.uses);
10467
+ defId = r.nextDefId;
10468
+ useId = r.nextUseId;
10469
+ }
10470
+ const handler = stmt.childForFieldName("handler");
10471
+ if (handler) {
10472
+ scopeStack.push(/* @__PURE__ */ new Map());
10473
+ const param = handler.childForFieldName("parameter");
10474
+ if (param) {
10475
+ const paramDefs = param.type === "identifier" ? [{ id: defId, variable: getNodeText(param), line: param.startPosition.row + 1, column: param.startPosition.column, kind: "local" }] : extractDestructuringDefs(param, defId);
10476
+ for (const def of paramDefs) {
10477
+ defs.push(def);
10478
+ currentScope(scopeStack).set(def.variable, def.id);
10479
+ markDeclared(currentScope(scopeStack), def.variable);
10480
+ defId++;
10481
+ }
10482
+ }
10483
+ const handlerBody = handler.childForFieldName("body");
10484
+ if (handlerBody) {
10485
+ const r = processStatement2(handlerBody, defId, useId, scopeStack, isJavaScript);
10486
+ defs.push(...r.defs);
10487
+ uses.push(...r.uses);
10488
+ defId = r.nextDefId;
10489
+ useId = r.nextUseId;
10490
+ }
10491
+ carryBranchDefsOut(scopeStack.pop(), scopeStack, false);
10492
+ }
10493
+ const finalizer6 = stmt.childForFieldName("finalizer");
10494
+ const finallyBody = finalizer6?.childForFieldName("body");
10495
+ if (finallyBody) {
10496
+ const r = processStatement2(finallyBody, defId, useId, scopeStack, isJavaScript);
10497
+ defs.push(...r.defs);
10498
+ uses.push(...r.uses);
10499
+ defId = r.nextDefId;
10500
+ useId = r.nextUseId;
10501
+ }
10502
+ break;
10503
+ }
10504
+ scopeStack.push(/* @__PURE__ */ new Map());
10505
+ const resources = stmt.childForFieldName("resources");
10506
+ for (const res of resources?.namedChildren ?? []) {
10507
+ if (!res || res.type !== "resource") continue;
10508
+ const nameNode = res.childForFieldName("name");
10509
+ const value = res.childForFieldName("value");
10510
+ if (value) {
10511
+ const valueUses = extractUses(value, useId, scopeStack, isJavaScript);
10512
+ uses.push(...valueUses.uses);
10513
+ useId = valueUses.nextId;
10514
+ }
10515
+ if (nameNode && nameNode.type === "identifier") {
10516
+ const def = { id: defId++, variable: getNodeText(nameNode), line: nameNode.startPosition.row + 1, column: nameNode.startPosition.column, kind: "local" };
10517
+ defs.push(def);
10518
+ currentScope(scopeStack).set(def.variable, def.id);
10519
+ markDeclared(currentScope(scopeStack), def.variable);
10520
+ } else if (!value) {
10521
+ const resUses = extractUses(res, useId, scopeStack, isJavaScript);
10522
+ uses.push(...resUses.uses);
10523
+ useId = resUses.nextId;
10524
+ }
10525
+ }
10526
+ for (const part of stmt.namedChildren) {
10527
+ if (!part) continue;
10528
+ if (part.type === "block") {
10529
+ const r = processStatement2(part, defId, useId, scopeStack, isJavaScript);
10530
+ defs.push(...r.defs);
10531
+ uses.push(...r.uses);
10532
+ defId = r.nextDefId;
10533
+ useId = r.nextUseId;
10534
+ } else if (part.type === "catch_clause") {
10535
+ scopeStack.push(/* @__PURE__ */ new Map());
10536
+ for (const param of part.namedChildren) {
10537
+ if (!param || param.type !== "catch_formal_parameter") continue;
10538
+ const pname = param.childForFieldName("name");
10539
+ if (pname) {
10540
+ const def = { id: defId++, variable: getNodeText(pname), line: pname.startPosition.row + 1, column: pname.startPosition.column, kind: "local" };
10541
+ defs.push(def);
10542
+ currentScope(scopeStack).set(def.variable, def.id);
10543
+ markDeclared(currentScope(scopeStack), def.variable);
10544
+ }
10545
+ }
10546
+ const body2 = part.childForFieldName("body");
10547
+ if (body2) {
10548
+ const r = processStatement2(body2, defId, useId, scopeStack, isJavaScript);
10549
+ defs.push(...r.defs);
10550
+ uses.push(...r.uses);
10551
+ defId = r.nextDefId;
10552
+ useId = r.nextUseId;
10553
+ }
10554
+ carryBranchDefsOut(scopeStack.pop(), scopeStack, false);
10555
+ } else if (part.type === "finally_clause") {
10556
+ for (const b of part.namedChildren) {
10557
+ if (!b || b.type !== "block") continue;
10558
+ const r = processStatement2(b, defId, useId, scopeStack, isJavaScript);
10559
+ defs.push(...r.defs);
10560
+ uses.push(...r.uses);
10561
+ defId = r.nextDefId;
10562
+ useId = r.nextUseId;
10563
+ }
10564
+ }
10565
+ }
10566
+ carryBranchDefsOut(scopeStack.pop(), scopeStack, false);
10567
+ break;
10568
+ }
10459
10569
  case "else_clause": {
10460
10570
  for (let i2 = 0; i2 < stmt.childCount; i2++) {
10461
10571
  const arm = stmt.child(i2);
@@ -11071,6 +11181,42 @@ function buildBashDFG(tree) {
11071
11181
  defs.push(def);
11072
11182
  currentScope(scopeStack).set(p, def.id);
11073
11183
  }
11184
+ const bashFnDefs = /* @__PURE__ */ new Map();
11185
+ const bashFnByNodeId = /* @__PURE__ */ new Map();
11186
+ for (const fn of findNodes(tree.rootNode, "function_definition")) {
11187
+ const nameNode = fn.childForFieldName("name");
11188
+ if (!nameNode) continue;
11189
+ const fnName = getNodeText(nameNode);
11190
+ if (!fnName || bashFnDefs.has(fnName)) continue;
11191
+ const m = /* @__PURE__ */ new Map();
11192
+ for (const p of positionalParams) {
11193
+ const def = {
11194
+ id: defIdCounter++,
11195
+ variable: p,
11196
+ line: fn.startPosition.row + 1,
11197
+ kind: "param",
11198
+ expression: `bash-fn:${fnName}`
11199
+ };
11200
+ defs.push(def);
11201
+ m.set(p, def.id);
11202
+ }
11203
+ bashFnDefs.set(fnName, m);
11204
+ bashFnByNodeId.set(fn.id, fnName);
11205
+ }
11206
+ const enclosingBashFn = (node) => {
11207
+ let cur = node.parent;
11208
+ while (cur) {
11209
+ if (cur.type === "function_definition") return bashFnByNodeId.get(cur.id) ?? null;
11210
+ cur = cur.parent;
11211
+ }
11212
+ return null;
11213
+ };
11214
+ const positionalDef = (varName, node, fallback) => {
11215
+ if (!positionalParams.includes(varName)) return fallback;
11216
+ const fnName = enclosingBashFn(node);
11217
+ if (!fnName) return fallback;
11218
+ return bashFnDefs.get(fnName)?.get(varName) ?? fallback;
11219
+ };
11074
11220
  walkTree(tree.rootNode, (node) => {
11075
11221
  if (node.type === "variable_assignment") {
11076
11222
  const nameNode = node.childForFieldName("name");
@@ -11123,7 +11269,7 @@ function buildBashDFG(tree) {
11123
11269
  if (varNameNode) {
11124
11270
  const varName = getNodeText(varNameNode);
11125
11271
  if (varName && !varName.startsWith("?") && !varName.startsWith("#")) {
11126
- let reachingDef = findReachingDef(varName, scopeStack);
11272
+ let reachingDef = positionalDef(varName, node, findReachingDef(varName, scopeStack));
11127
11273
  if (reachingDef === null && !positionalParams.includes(varName)) {
11128
11274
  const def = {
11129
11275
  id: defIdCounter++,
@@ -11147,7 +11293,7 @@ function buildBashDFG(tree) {
11147
11293
  const varNameNode = node.namedChildCount > 0 ? node.namedChild(0) : null;
11148
11294
  if (varNameNode && varNameNode.type === "variable_name") {
11149
11295
  const varName = getNodeText(varNameNode);
11150
- let reachingDef = findReachingDef(varName, scopeStack);
11296
+ let reachingDef = positionalDef(varName, node, findReachingDef(varName, scopeStack));
11151
11297
  if (reachingDef === null && !positionalParams.includes(varName)) {
11152
11298
  const def = {
11153
11299
  id: defIdCounter++,
@@ -11169,8 +11315,56 @@ function buildBashDFG(tree) {
11169
11315
  }
11170
11316
  });
11171
11317
  const chains = computeChains(defs, uses);
11318
+ chains.push(...bashCallArgChains(tree, bashFnDefs, uses, positionalParams));
11172
11319
  return { defs, uses, chains };
11173
11320
  }
11321
+ function bashCallArgChains(tree, bashFnDefs, uses, positionalParams) {
11322
+ const chains = [];
11323
+ if (bashFnDefs.size === 0) return chains;
11324
+ const renumbers = /* @__PURE__ */ new Set();
11325
+ for (const fn of findNodes(tree.rootNode, "function_definition")) {
11326
+ const nameNode = fn.childForFieldName("name");
11327
+ if (!nameNode) continue;
11328
+ if (/\bshift\b|\bset\s+--/.test(getNodeText(fn))) renumbers.add(getNodeText(nameNode));
11329
+ }
11330
+ const usesByLine = /* @__PURE__ */ new Map();
11331
+ for (const u of uses) {
11332
+ const l = usesByLine.get(u.line) ?? [];
11333
+ l.push(u);
11334
+ usesByLine.set(u.line, l);
11335
+ }
11336
+ for (const cmd of findNodes(tree.rootNode, "command")) {
11337
+ const nameNode = cmd.childForFieldName("name");
11338
+ if (!nameNode) continue;
11339
+ const fnDefs = bashFnDefs.get(getNodeText(nameNode));
11340
+ if (!fnDefs) continue;
11341
+ const fnName = getNodeText(nameNode);
11342
+ let position = 0;
11343
+ for (let i2 = 0; i2 < cmd.childCount; i2++) {
11344
+ const arg = cmd.child(i2);
11345
+ if (!arg || arg.id === nameNode.id) continue;
11346
+ if (arg.type.includes("redirect") || arg.type === "heredoc_body" || arg.type === "file_descriptor") continue;
11347
+ const text = getNodeText(arg);
11348
+ if (!text.trim()) continue;
11349
+ position++;
11350
+ const names = /* @__PURE__ */ new Set();
11351
+ const re = /\$\{?([A-Za-z_][A-Za-z0-9_]*|[0-9@*])/g;
11352
+ let m;
11353
+ while ((m = re.exec(text)) !== null) names.add(m[1]);
11354
+ if (names.size === 0) continue;
11355
+ const spreads = /\$\{?[@*]/.test(text);
11356
+ const targets = spreads || renumbers.has(fnName) ? positionalParams.map((p) => fnDefs.get(p)).filter((d) => d !== void 0) : [fnDefs.get(String(position))].filter((d) => d !== void 0);
11357
+ const lineUses = usesByLine.get(arg.startPosition.row + 1) ?? [];
11358
+ for (const name2 of names) {
11359
+ for (const u of lineUses) {
11360
+ if (u.variable !== name2 || u.def_id === null) continue;
11361
+ for (const t of targets) chains.push({ from_def: u.def_id, to_def: t, via: name2 });
11362
+ }
11363
+ }
11364
+ }
11365
+ }
11366
+ return chains;
11367
+ }
11174
11368
  function buildRustDFG(tree, cache) {
11175
11369
  const defs = [];
11176
11370
  const uses = [];
@@ -11705,6 +11899,46 @@ function extractGoAddressableVarName(node) {
11705
11899
  return null;
11706
11900
  }
11707
11901
 
11902
+ // src/analysis/js-helper-return.ts
11903
+ function jsHelperReturnsNoParam(sourceCode, rawName) {
11904
+ if (!/^[A-Za-z_$][\w$]*$/.test(rawName)) return false;
11905
+ const name2 = rawName.replace(/\$/g, "\\$");
11906
+ const decls = [...sourceCode.matchAll(new RegExp(`\\bfunction\\s+${name2}\\s*\\(([^)]*)\\)\\s*\\{`, "g"))];
11907
+ if (decls.length !== 1) return false;
11908
+ if (new RegExp(`(?:const|let|var)\\s+${name2}\\s*=`).test(sourceCode)) return false;
11909
+ const open = (decls[0].index ?? 0) + decls[0][0].length - 1;
11910
+ let depth = 0;
11911
+ let close = -1;
11912
+ for (let i2 = open; i2 < sourceCode.length; i2++) {
11913
+ const ch = sourceCode[i2];
11914
+ if (ch === "{") depth++;
11915
+ else if (ch === "}" && --depth === 0) {
11916
+ close = i2;
11917
+ break;
11918
+ }
11919
+ }
11920
+ if (close < 0) return false;
11921
+ const body2 = sourceCode.slice(open + 1, close).replace(/\/\/.*$/gm, "");
11922
+ if (/\bfunction\b|=>/.test(body2)) return false;
11923
+ const literal = /^(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d+(?:\.\d+)?|true|false|null)$/;
11924
+ const returns = [...body2.matchAll(/\breturn\b\s*([^;]*);?/g)].map((m) => m[1].trim());
11925
+ if (returns.length === 0) return false;
11926
+ for (const expr of returns) {
11927
+ if (literal.test(expr)) continue;
11928
+ const slot = /^([A-Za-z_$][\w$]*)\s*\[\s*(\d+)\s*\]$/.exec(expr);
11929
+ if (!slot) return false;
11930
+ const arr = slot[1].replace(/\$/g, "\\$");
11931
+ const declRe = new RegExp(`(?:const|let|var)\\s+${arr}\\s*=\\s*\\[([^\\]]*)\\]\\s*;?`);
11932
+ const d = declRe.exec(body2);
11933
+ if (!d) return false;
11934
+ if (new RegExp(`\\b${arr}\\s*(?:\\[[^\\]]*\\]\\s*=(?!=)|\\.\\s*(?:push|unshift|splice|shift|pop|reverse|sort|fill|copyWithin)\\s*\\()`).test(body2)) return false;
11935
+ const elems = d[1].split(",").map((e) => e.trim());
11936
+ const el = elems[Number(slot[2])];
11937
+ if (el === void 0 || !literal.test(el)) return false;
11938
+ }
11939
+ return true;
11940
+ }
11941
+
11708
11942
  // src/analysis/literal-expression.ts
11709
11943
  function isProvablyLiteralExpression(expr) {
11710
11944
  let e = (expr ?? "").trim();
@@ -11880,6 +12114,198 @@ function javaReplaceCrLfCoverage(method, rawFrom) {
11880
12114
  return { cr, lf };
11881
12115
  }
11882
12116
 
12117
+ // src/analysis/js-crlf-strip.ts
12118
+ var MAX_PATTERN_LENGTH = 200;
12119
+ var NEUTRAL_AFTER_REPLACE = /* @__PURE__ */ new Set([
12120
+ "replace",
12121
+ "replaceAll",
12122
+ "trim",
12123
+ "trimStart",
12124
+ "trimEnd",
12125
+ "toString",
12126
+ "toLowerCase",
12127
+ "toUpperCase",
12128
+ "slice",
12129
+ "substring"
12130
+ ]);
12131
+ var PROBE = "a\r\rb\n\nc\r\nd\n\re x ";
12132
+ function readQuoted(s, i2) {
12133
+ const q = s[i2];
12134
+ if (q !== '"' && q !== "'" && q !== "`") return null;
12135
+ let out2 = "";
12136
+ for (let j = i2 + 1; j < s.length; j++) {
12137
+ const c = s[j];
12138
+ if (c === q) return { value: out2, end: j + 1 };
12139
+ if (q === "`" && c === "$" && s[j + 1] === "{") return null;
12140
+ if (c === "\\") {
12141
+ const n = s[j + 1];
12142
+ if (n === void 0) return null;
12143
+ switch (n) {
12144
+ case "n":
12145
+ out2 += "\n";
12146
+ j++;
12147
+ continue;
12148
+ case "r":
12149
+ out2 += "\r";
12150
+ j++;
12151
+ continue;
12152
+ case "t":
12153
+ out2 += " ";
12154
+ j++;
12155
+ continue;
12156
+ case "0":
12157
+ out2 += "\0";
12158
+ j++;
12159
+ continue;
12160
+ case "x": {
12161
+ const h = /^[0-9a-fA-F]{2}/.exec(s.slice(j + 2, j + 4));
12162
+ if (!h) return null;
12163
+ out2 += String.fromCharCode(parseInt(h[0], 16));
12164
+ j += 3;
12165
+ continue;
12166
+ }
12167
+ case "u": {
12168
+ const h = /^[0-9a-fA-F]{4}/.exec(s.slice(j + 2, j + 6));
12169
+ if (!h) return null;
12170
+ out2 += String.fromCharCode(parseInt(h[0], 16));
12171
+ j += 5;
12172
+ continue;
12173
+ }
12174
+ default:
12175
+ out2 += n;
12176
+ j++;
12177
+ continue;
12178
+ }
12179
+ }
12180
+ if (c === "\n" && q !== "`") return null;
12181
+ out2 += c;
12182
+ }
12183
+ return null;
12184
+ }
12185
+ function readRegexLiteral(s, i2) {
12186
+ if (s[i2] !== "/") return null;
12187
+ let inClass = false;
12188
+ for (let j = i2 + 1; j < s.length; j++) {
12189
+ const c = s[j];
12190
+ if (c === "\n") return null;
12191
+ if (c === "\\") {
12192
+ j++;
12193
+ continue;
12194
+ }
12195
+ if (inClass) {
12196
+ if (c === "]") inClass = false;
12197
+ continue;
12198
+ }
12199
+ if (c === "[") {
12200
+ inClass = true;
12201
+ continue;
12202
+ }
12203
+ if (c === "/") {
12204
+ const flags2 = /^[dgimsuvy]*/.exec(s.slice(j + 1))[0];
12205
+ return { source: s.slice(i2 + 1, j), flags: flags2, end: j + 1 + flags2.length };
12206
+ }
12207
+ }
12208
+ return null;
12209
+ }
12210
+ var skipWs = (s, i2) => {
12211
+ while (i2 < s.length && /\s/.test(s[i2])) i2++;
12212
+ return i2;
12213
+ };
12214
+ function parseSteps(chainText) {
12215
+ const steps = [];
12216
+ const callRe = /\.\s*(replaceAll|replace)\s*\(/g;
12217
+ let m;
12218
+ while ((m = callRe.exec(chainText)) !== null) {
12219
+ const kind = m[1];
12220
+ let i2 = skipWs(chainText, m.index + m[0].length);
12221
+ let pattern;
12222
+ const rx = readRegexLiteral(chainText, i2);
12223
+ if (rx) {
12224
+ if (rx.source.length > MAX_PATTERN_LENGTH) return null;
12225
+ try {
12226
+ pattern = new RegExp(rx.source, rx.flags);
12227
+ } catch {
12228
+ return null;
12229
+ }
12230
+ i2 = rx.end;
12231
+ } else {
12232
+ const str = readQuoted(chainText, i2);
12233
+ if (!str) return null;
12234
+ pattern = str.value;
12235
+ i2 = str.end;
12236
+ }
12237
+ i2 = skipWs(chainText, i2);
12238
+ if (chainText[i2] !== ",") return null;
12239
+ i2 = skipWs(chainText, i2 + 1);
12240
+ const rep = readQuoted(chainText, i2);
12241
+ if (!rep) return null;
12242
+ i2 = skipWs(chainText, rep.end);
12243
+ if (chainText[i2] !== ")") return null;
12244
+ steps.push({ kind, pattern, replacement: rep.value });
12245
+ callRe.lastIndex = i2 + 1;
12246
+ }
12247
+ return steps;
12248
+ }
12249
+ function run2(steps, input) {
12250
+ let s = input;
12251
+ try {
12252
+ for (const st of steps) {
12253
+ if (st.kind === "replaceAll" && st.pattern instanceof RegExp && !st.pattern.global) return null;
12254
+ s = st.kind === "replaceAll" ? s.replaceAll(st.pattern, st.replacement) : s.replace(st.pattern, st.replacement);
12255
+ }
12256
+ } catch {
12257
+ return null;
12258
+ }
12259
+ return s;
12260
+ }
12261
+ function jsReplaceChainVerdict(chainText) {
12262
+ const steps = parseSteps(chainText);
12263
+ if (!steps || steps.length === 0) return "undecided";
12264
+ const first = chainText.search(/\.\s*(?:replaceAll|replace)\s*\(/);
12265
+ for (const seg of chainText.slice(first + 1).matchAll(/\.\s*([A-Za-z_$][\w$]*)\s*\(/g)) {
12266
+ if (!NEUTRAL_AFTER_REPLACE.has(seg[1])) return "undecided";
12267
+ }
12268
+ const out2 = run2(steps, PROBE);
12269
+ if (out2 === null) return "undecided";
12270
+ return out2.includes("\r") || out2.includes("\n") ? "leaves-crlf" : "strips-crlf";
12271
+ }
12272
+ function jsChainTextAt(sourceLines, line, column) {
12273
+ const text = [(sourceLines[line - 1] ?? "").slice(column), ...sourceLines.slice(line, line + 7)].join("\n");
12274
+ let depth = 0;
12275
+ let prevSig = "";
12276
+ let i2 = 0;
12277
+ for (; i2 < text.length; i2++) {
12278
+ const c = text[i2];
12279
+ if (c === '"' || c === "'" || c === "`") {
12280
+ for (i2++; i2 < text.length && text[i2] !== c; i2++) if (text[i2] === "\\") i2++;
12281
+ prevSig = c;
12282
+ continue;
12283
+ }
12284
+ if (c === "/" && depth > 0 && (prevSig === "(" || prevSig === ",")) {
12285
+ const rx = readRegexLiteral(text, i2);
12286
+ if (rx) {
12287
+ i2 = rx.end - 1;
12288
+ prevSig = "/";
12289
+ continue;
12290
+ }
12291
+ }
12292
+ if (c === "(" || c === "[" || c === "{") {
12293
+ depth++;
12294
+ prevSig = c;
12295
+ continue;
12296
+ }
12297
+ if (c === ")" || c === "]" || c === "}") {
12298
+ if (depth === 0) break;
12299
+ depth--;
12300
+ prevSig = c;
12301
+ continue;
12302
+ }
12303
+ if (depth === 0 && !/[\w$.\s]/.test(c)) break;
12304
+ if (!/\s/.test(c)) prevSig = c;
12305
+ }
12306
+ return text.slice(0, i2);
12307
+ }
12308
+
11883
12309
  // src/analysis/passes/language-sources-pass.ts
11884
12310
  var JINJA_LITERAL_ARG_RE_FRAG = `(?:"[^"\\\\]*"|'[^'\\\\]*')`;
11885
12311
  var JINJA_SAFE_RTS_RE = new RegExp(
@@ -12663,6 +13089,10 @@ var DEFAULT_SOURCES = [
12663
13089
  { method: "get", class: "Redis", type: "db_input", severity: "medium", return_tainted: true, languages: ["javascript", "typescript"] },
12664
13090
  { method: "hget", class: "Redis", type: "db_input", severity: "medium", return_tainted: true, languages: ["javascript", "typescript"] },
12665
13091
  { method: "mget", class: "Redis", type: "db_input", severity: "medium", return_tainted: true, languages: ["javascript", "typescript"] },
13092
+ // Node redis clients are often bound to `cache` from `createClient()`; class
13093
+ // `cache` is scoped to JS/TS (Python Django cache above) and Map.get is
13094
+ // filtered in sink-filter-pass (#818 src14).
13095
+ { method: "get", class: "cache", type: "db_input", severity: "medium", return_tainted: true, languages: ["javascript", "typescript"] },
12666
13096
  { method: "get", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
12667
13097
  { method: "hget", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
12668
13098
  { method: "mget", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
@@ -12842,7 +13272,9 @@ var TRUST_BOUNDARY_FRAMEWORK_SINKS = [
12842
13272
  // on arg[1] (the *Cookie) catches struct-literal composite tainting.
12843
13273
  { method: "SetCookie", class: "http", type: "trust_boundary", cwe: "CWE-501", severity: "medium", arg_positions: [1], languages: ["go"] },
12844
13274
  // gin: c.SetCookie(name, value, maxAge, path, domain, secure, httpOnly).
12845
- { method: "SetCookie", class: "Context", type: "trust_boundary", cwe: "CWE-501", severity: "medium", arg_positions: [1], languages: ["go"] }
13275
+ { method: "SetCookie", class: "Context", type: "trust_boundary", cwe: "CWE-501", severity: "medium", arg_positions: [1], languages: ["go"] },
13276
+ // --- Rust: actix-session / tower-sessions write -------------------------
13277
+ { method: "insert", class: "Session", type: "trust_boundary", cwe: "CWE-501", severity: "medium", arg_positions: [1], languages: ["rust"] }
12846
13278
  ];
12847
13279
  var DEFAULT_SINKS = [
12848
13280
  // SQL Injection (CWE-89)
@@ -13272,7 +13704,7 @@ var DEFAULT_SINKS = [
13272
13704
  { method: "renderHTML", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
13273
13705
  { method: "parseHTML", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
13274
13706
  // HTML sanitizer/validator sinks (AntiSamy, OWASP HTML Sanitizer, etc.)
13275
- { method: "scan", class: "AntiSamy", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
13707
+ { method: "scan", class: "AntiSamy", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["java"] },
13276
13708
  { method: "isValid", class: "SafeHtmlValidator", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
13277
13709
  { method: "sanitize", class: "PolicyFactory", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
13278
13710
  { method: "validate", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0] },
@@ -13288,8 +13720,8 @@ var DEFAULT_SINKS = [
13288
13720
  { method: "writeAttribute", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0, 1] },
13289
13721
  // AntiSamy specific (SAX filters)
13290
13722
  { method: "startElement", class: "MagicSAXFilter", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0, 1, 2] },
13291
- { method: "scan", class: "AntiSamyDOMScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
13292
- { method: "scan", class: "AntiSamySAXScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
13723
+ { method: "scan", class: "AntiSamyDOMScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["java"] },
13724
+ { method: "scan", class: "AntiSamySAXScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["java"] },
13293
13725
  // Hibernate Validator
13294
13726
  { method: "getFragmentAsDocument", class: "SafeHtmlValidator", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
13295
13727
  // JSPWiki specific
@@ -13339,15 +13771,15 @@ var DEFAULT_SINKS = [
13339
13771
  { method: "getValidListItem", class: "DefaultValidator", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0, 1] },
13340
13772
  { method: "isValidURI", class: "DefaultValidator", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0, 1] },
13341
13773
  // AntiSamy test/processing methods
13342
- { method: "scriptAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
13343
- { method: "imgAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
13344
- { method: "hrefAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
13345
- { method: "cssAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
13346
- { method: "IllegalXML", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
13347
- { method: "testIssue2", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
13348
- { method: "issue41", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
13349
- { method: "testGithubIssue151", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
13350
- { method: "processStyleTag", class: "AntiSamyDOMScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
13774
+ { method: "scriptAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
13775
+ { method: "imgAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
13776
+ { method: "hrefAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
13777
+ { method: "cssAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
13778
+ { method: "IllegalXML", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
13779
+ { method: "testIssue2", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
13780
+ { method: "issue41", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
13781
+ { method: "testGithubIssue151", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
13782
+ { method: "processStyleTag", class: "AntiSamyDOMScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["java"] },
13351
13783
  // JSON Sanitizer
13352
13784
  { method: "sanitizeString", class: "JsonSanitizer", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
13353
13785
  { method: "testIssue13", class: "JsonSanitizerTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
@@ -13503,7 +13935,9 @@ var DEFAULT_SINKS = [
13503
13935
  { method: "addParametersToContext", class: "StaticParametersInterceptor", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0] },
13504
13936
  { method: "build", class: "HttpParameters", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0] },
13505
13937
  // Cron expression parsing (DoS/ReDoS)
13506
- { method: "parse", class: "CronParser", type: "code_injection", cwe: "CWE-94", severity: "high", arg_positions: [0] },
13938
+ // cognium-dev#998 — Java cron-utils `CronParser`; scoped to Java so a JS/TS
13939
+ // `parser.parse(...)` (tree-sitter, a lockfile parser) never matches it by name.
13940
+ { method: "parse", class: "CronParser", type: "code_injection", cwe: "CWE-94", severity: "high", arg_positions: [0], languages: ["java"] },
13507
13941
  { method: "isValid", class: "CronValidator", type: "code_injection", cwe: "CWE-94", severity: "high", arg_positions: [0] },
13508
13942
  // ff4j feature flags
13509
13943
  { method: "check", class: "FF4j", type: "code_injection", cwe: "CWE-94", severity: "high", arg_positions: [0] },
@@ -13600,9 +14034,13 @@ var DEFAULT_SINKS = [
13600
14034
  { method: "selectNodes", class: "Node", type: "xpath_injection", cwe: "CWE-643", severity: "high", arg_positions: [0] },
13601
14035
  { method: "selectSingleNode", class: "Node", type: "xpath_injection", cwe: "CWE-643", severity: "high", arg_positions: [0] },
13602
14036
  // XXE - XML External Entity (CWE-611)
13603
- { method: "parse", class: "DocumentBuilder", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0] },
13604
- { method: "parse", class: "SAXParser", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0] },
13605
- { method: "parse", class: "XMLReader", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0] },
14037
+ // cognium-dev#998 — JAXP parsers are JVM classes. Scoped to Java so the
14038
+ // receiver-name heuristic (`parser` → SAXParser) cannot turn a JS/TS
14039
+ // `parser.parse(text)` into an XXE sink. JS/TS XML parsers (sax, xml2js,
14040
+ // libxmljs, DOMParser) have their own entries.
14041
+ { method: "parse", class: "DocumentBuilder", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0], languages: ["java"] },
14042
+ { method: "parse", class: "SAXParser", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0], languages: ["java"] },
14043
+ { method: "parse", class: "XMLReader", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0], languages: ["java"] },
13606
14044
  { method: "unmarshal", class: "Unmarshaller", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0] },
13607
14045
  { method: "newTransformer", class: "TransformerFactory", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0] },
13608
14046
  { method: "transform", class: "Transformer", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0] },
@@ -13857,6 +14295,46 @@ var DEFAULT_SINKS = [
13857
14295
  { method: "each", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], allow_unresolved_receiver: true },
13858
14296
  { method: "get", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], allow_unresolved_receiver: true },
13859
14297
  { method: "exec", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], allow_unresolved_receiver: true },
14298
+ // DuckDB from JS/TS: `@duckdb/node-api` (DuckDBConnection), the classic
14299
+ // `duckdb` / `duckdb-async` bindings (Database / Connection) and
14300
+ // `react-native-duckdb` (Database / Transaction). The method names are
14301
+ // generic and the receivers come from factories (`await instance.connect()`,
14302
+ // `open({...})`), so the receiver cannot be typed: the import is the gate
14303
+ // (`requires_import`). Only the SQL text (arg 0) is a sink — values passed
14304
+ // as bound parameters (`run(sql, [v])`, `execute(sql, params)`,
14305
+ // `executeNamed(sql, {k: v})`, `stmt.bind(...)`) are parameterised and do
14306
+ // not reach it.
14307
+ { method: "run", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api", "duckdb", "duckdb-async"] },
14308
+ { method: "prepare", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api", "duckdb", "duckdb-async", "react-native-duckdb"] },
14309
+ { method: "stream", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api", "duckdb", "duckdb-async", "react-native-duckdb"] },
14310
+ { method: "runAndRead", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
14311
+ { method: "runAndReadAll", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
14312
+ { method: "runAndReadUntil", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
14313
+ { method: "streamAndRead", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
14314
+ { method: "streamAndReadAll", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
14315
+ { method: "streamAndReadUntil", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
14316
+ { method: "start", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
14317
+ { method: "startStream", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
14318
+ { method: "extractStatements", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
14319
+ { method: "all", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["duckdb", "duckdb-async"] },
14320
+ { method: "each", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["duckdb", "duckdb-async"] },
14321
+ { method: "exec", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["duckdb", "duckdb-async"] },
14322
+ { method: "arrowIPCAll", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["duckdb", "duckdb-async"] },
14323
+ { method: "arrowIPCStream", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["duckdb", "duckdb-async"] },
14324
+ { method: "execute", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["react-native-duckdb"] },
14325
+ { method: "executeSync", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["react-native-duckdb"] },
14326
+ { method: "executeNamed", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["react-native-duckdb"] },
14327
+ { method: "executeSyncNamed", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["react-native-duckdb"] },
14328
+ { method: "streamNamed", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["react-native-duckdb"] },
14329
+ // RxDB (Mango queries, any storage incl. SQLite): a selector or query
14330
+ // object, a field name passed to the query builder, or a `$regex` pattern
14331
+ // under caller control is NoSQL operator injection (CWE-943). Gated on the
14332
+ // `rxdb` import for the same reason as DuckDB above. `find` is already a
14333
+ // classless JS NoSQL sink in the JavaScript plugin.
14334
+ { method: "findOne", type: "nosql_injection", cwe: "CWE-943", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["rxdb"] },
14335
+ { method: "count", type: "nosql_injection", cwe: "CWE-943", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["rxdb"] },
14336
+ { method: "where", type: "nosql_injection", cwe: "CWE-943", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["rxdb"] },
14337
+ { method: "regex", type: "nosql_injection", cwe: "CWE-943", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["rxdb"] },
13860
14338
  // TypeORM QueryBuilder raw fragments (CWE-89). TypeORM's raw `.query(sql)`
13861
14339
  // escape hatch is already covered by the classless `query` sink in the JS
13862
14340
  // plugin (getBuiltinSinks), so it is NOT re-registered here — the dedup
@@ -13967,6 +14445,8 @@ var DEFAULT_SINKS = [
13967
14445
  { method: "get", class: "http", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
13968
14446
  { method: "request", class: "https", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
13969
14447
  { method: "get", class: "https", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
14448
+ // Node.js dns.promises (CWE-918 / NUL-in-name SSRF class — #895)
14449
+ { method: "resolve", class: "dns.promises", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"] },
13970
14450
  // needle library (used in NodeGoat)
13971
14451
  { method: "get", class: "needle", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
13972
14452
  { method: "post", class: "needle", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
@@ -14125,16 +14605,16 @@ var DEFAULT_SINKS = [
14125
14605
  { method: "parse", class: "sax", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0] },
14126
14606
  { method: "XMLParser", class: "lxml", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0] },
14127
14607
  // Python LDAP Injection
14128
- { method: "search", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2] },
14129
- { method: "search_s", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2] },
14130
- { method: "search_ext", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2] },
14131
- { method: "search_ext_s", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2] },
14608
+ { method: "search", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2], languages: ["python"] },
14609
+ { method: "search_s", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2], languages: ["python"] },
14610
+ { method: "search_ext", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2], languages: ["python"] },
14611
+ { method: "search_ext_s", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2], languages: ["python"] },
14132
14612
  // ldap3 library (different API from python-ldap)
14133
- { method: "search", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 1] },
14134
- { method: "extend", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0] },
14135
- { method: "modify", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0] },
14136
- { method: "add", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0] },
14137
- { method: "delete", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0] },
14613
+ { method: "search", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 1], languages: ["python"] },
14614
+ { method: "extend", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0], languages: ["python"] },
14615
+ { method: "modify", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0], languages: ["python"] },
14616
+ { method: "add", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0], languages: ["python"] },
14617
+ { method: "delete", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0], languages: ["python"] },
14138
14618
  // Python Trust Boundary (CWE-501)
14139
14619
  // The vulnerability is storing untrusted data in session that gets trusted later
14140
14620
  { method: "__setitem__", class: "session", type: "trust_boundary", cwe: "CWE-501", severity: "medium", arg_positions: [1] },
@@ -14225,7 +14705,7 @@ var DEFAULT_SINKS = [
14225
14705
  { method: "put", class: "VelocityContext", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [1] },
14226
14706
  { method: "setVariable", class: "Context", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [1] },
14227
14707
  // HTML sanitizer bypass markers (known CVE patterns)
14228
- { method: "clean", class: "AntiSamy", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0] },
14708
+ { method: "clean", class: "AntiSamy", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0], languages: ["java"] },
14229
14709
  { method: "getValidSafeHTML", class: "ESAPI", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0] },
14230
14710
  // NOTE (cognium-dev#270): `HttpServletRequest`/`HttpSession.getAttribute()`
14231
14711
  // were registered here as xss sinks to model "attribute reflection XSS", but
@@ -14461,7 +14941,7 @@ var DEFAULT_SINKS = [
14461
14941
  // receiver-taint or operator-LHS-taint tracking — the format string is the
14462
14942
  // receiver, not an argument. Deferred to Sprint 6 (#86 follow-up).
14463
14943
  // C-style: printf / fprintf / sprintf / snprintf via ctypes/cffi.
14464
- { method: "printf", type: "format_string", cwe: "CWE-134", severity: "high", arg_positions: [0], languages: ["python"] },
14944
+ { method: "printf", type: "format_string", cwe: "CWE-134", severity: "high", arg_positions: [0], languages: ["python", "rust"] },
14465
14945
  { method: "fprintf", type: "format_string", cwe: "CWE-134", severity: "high", arg_positions: [1], languages: ["python"] },
14466
14946
  // Go: fmt.Sprintf/Printf/Fprintf/Errorf — format string is first/second arg
14467
14947
  { method: "Sprintf", class: "fmt", type: "format_string", cwe: "CWE-134", severity: "medium", arg_positions: [0], languages: ["go"] },
@@ -15346,380 +15826,188 @@ var DEFAULT_SANITIZERS = [
15346
15826
  // urllib.parse.quote_plus(x) — same + space→+; safe for query string
15347
15827
  // urllib.parse.urlencode(d) — encode a dict of pairs
15348
15828
  //
15349
- // Bounded to URL-context sinks. Class-scoped to the specific
15350
- // `urllib.parse` receiver to avoid colliding with unrelated bare
15351
- // `quote(...)` calls in other libraries.
15352
- { method: "quote", class: "urllib.parse", removes: ["ssrf", "open_redirect", "xss", "path_traversal"] },
15353
- { method: "quote_plus", class: "urllib.parse", removes: ["ssrf", "open_redirect", "xss", "path_traversal"] },
15354
- { method: "urlencode", class: "urllib.parse", removes: ["ssrf", "open_redirect", "xss"] },
15355
- // Bare aliases — `from urllib.parse import quote` then unqualified.
15356
- { method: "quote_plus", removes: ["ssrf", "open_redirect", "xss", "path_traversal"] },
15357
- { method: "urlencode", removes: ["ssrf", "open_redirect", "xss"] },
15358
- // `quote` bare is intentionally NOT registered — it collides with
15359
- // shlex.quote (bare-imported) which is a command_injection sanitizer,
15360
- // not a URL sanitizer. The class-scoped variant above catches the
15361
- // qualified `urllib.parse.quote(...)` shape; unqualified callers who
15362
- // want URL-context credit should use `quote_plus` (which does not
15363
- // collide with any command_injection sanitizer).
15364
- // Python XSS — additional common sanitizers.
15365
- //
15366
- // bleach.clean(...) — already covered above (line 2898)
15367
- // bleach.linkify(...) — turns URLs into anchor tags; sanitizes as well
15368
- // django.utils.html.escape / strip_tags — Django's XSS escape helpers
15369
- // jinja2.escape — Jinja2's Markup escape (aliased from markupsafe)
15370
- // flask.escape — Flask re-export of markupsafe.escape
15371
- // saxutils.escape — stdlib xml.sax.saxutils.escape for XML docs
15372
- { method: "linkify", class: "bleach", removes: ["xss"] },
15373
- // Bare `linkify(...)` alias — `from bleach import linkify`.
15374
- { method: "linkify", removes: ["xss"] },
15375
- { method: "escape", class: "django.utils.html", removes: ["xss"] },
15376
- { method: "strip_tags", class: "django.utils.html", removes: ["xss"] },
15377
- { method: "escape", class: "jinja2", removes: ["xss"] },
15378
- { method: "escape", class: "flask", removes: ["xss"] },
15379
- { method: "escape", class: "saxutils", removes: ["xss"] },
15380
- { method: "escape", class: "xml.sax.saxutils", removes: ["xss"] },
15381
- { method: "quoteattr", class: "saxutils", removes: ["xss"] },
15382
- { method: "quoteattr", class: "xml.sax.saxutils", removes: ["xss"] },
15383
- // Python ReDoS — `re.escape(user)` when building a regex from user input
15384
- // strips regex metacharacters. Downstream `re.compile / re.match` cannot
15385
- // interpret user-supplied alternations or quantifiers. Also covers the
15386
- // `code_injection` categorization that `re.compile` currently emits
15387
- // (a re.escape-wrapped pattern cannot execute anything, so both are safe).
15388
- { method: "escape", class: "re", removes: ["redos", "code_injection"] },
15389
- // Python SQLAlchemy — `text(...).bindparams(...)` binds params safely.
15390
- // The `bindparams` call is the sanitizer; the parent `text` wraps the
15391
- // template. Also add `expression.literal` for explicit SQL literals.
15392
- { method: "bindparams", removes: ["sql_injection"] },
15393
- // psycopg2 sql-composition helpers
15394
- { method: "Identifier", class: "sql", removes: ["sql_injection"] },
15395
- { method: "Literal", class: "sql", removes: ["sql_injection"] },
15396
- { method: "Placeholder", class: "sql", removes: ["sql_injection"] },
15397
- // =========================================================================
15398
- // Rust Sanitizers
15399
- // =========================================================================
15400
- // Rust SQL - sqlx query! macro is compile-time checked (parameterized)
15401
- { method: "query!", removes: ["sql_injection"] },
15402
- { method: "query_as!", removes: ["sql_injection"] },
15403
- { method: "query_scalar!", removes: ["sql_injection"] },
15404
- { method: "query_unchecked!", removes: ["sql_injection"] },
15405
- // Diesel DSL (type-safe query builder)
15406
- { method: "filter", class: "diesel", removes: ["sql_injection"] },
15407
- { method: "eq", class: "diesel", removes: ["sql_injection"] },
15408
- // Rust Path Traversal - basename/file_name extracts just the filename
15409
- { method: "file_name", removes: ["path_traversal"] },
15410
- { method: "file_stem", removes: ["path_traversal"] },
15411
- { method: "extension", removes: ["path_traversal"] },
15412
- { method: "canonicalize", removes: ["path_traversal"] },
15413
- // Resolves symlinks, validates path exists
15414
- // Rust Command Injection - allowlist validation
15415
- { method: "contains", removes: ["command_injection", "ssrf", "open_redirect"] },
15416
- // Used for allowlist checks
15417
- { method: "starts_with", removes: ["path_traversal", "ssrf", "open_redirect"] },
15418
- // Path/URL prefix validation
15419
- { method: "ends_with", removes: ["path_traversal", "open_redirect"] },
15420
- // Rust XSS - HTML escaping
15421
- { method: "escape", class: "html_escape", removes: ["xss"] },
15422
- { method: "encode_text", class: "html_escape", removes: ["xss"] },
15423
- { method: "encode_attribute", class: "html_escape", removes: ["xss"] },
15424
- { method: "escape_html", removes: ["xss"] },
15425
- // Rust Type coercion (parsing)
15426
- { method: "parse", removes: ["sql_injection", "command_injection", "xss"] },
15427
- // str.parse::<i32>()
15428
- // =========================================================================
15429
- // Type-cast taint barriers (#57)
15430
- // Numeric/UUID casts cannot carry a string-injection payload.
15431
- // =========================================================================
15432
- // Java numeric parse — Integer.parseInt, Long.parseLong, etc.
15433
- { method: "parseInt", class: "Integer", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15434
- { method: "parseLong", class: "Long", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15435
- { method: "parseFloat", class: "Float", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15436
- { method: "parseDouble", class: "Double", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15437
- { method: "parseShort", class: "Short", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15438
- { method: "parseByte", class: "Byte", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15439
- // cognium-dev #238 A.3 — parseBoolean and expanded coercion coverage for XSS/CRLF/log/xpath/ldap/xxe.
15440
- // A parsed boolean/numeric cannot carry a string-injection payload for any string-based sink.
15441
- { method: "parseBoolean", class: "Boolean", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection", "xss", "crlf", "log_injection", "xpath_injection", "ldap_injection", "xxe"] },
15442
- // Java UUID parse — UUID.fromString rejects non-UUID strings
15443
- { method: "fromString", class: "UUID", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15444
- // JavaScript numeric coercion (Number/parseInt/parseFloat already covered above; add path_traversal/code_injection)
15445
- { method: "BigInt", removes: ["sql_injection", "nosql_injection", "command_injection", "path_traversal", "code_injection"] },
15446
- // Go numeric parse — strconv.Atoi, ParseInt, ParseFloat, ParseUint, ParseBool
15447
- { method: "Atoi", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15448
- { method: "ParseInt", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15449
- { method: "ParseFloat", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15450
- { method: "ParseUint", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15451
- { method: "ParseBool", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15452
- // Go UUID parse
15453
- { method: "Parse", class: "uuid", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15454
- { method: "MustParse", class: "uuid", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15455
- // Python — int/float already covered above; add bool + UUID/Decimal casts
15456
- { method: "bool", removes: ["sql_injection", "command_injection", "xss", "code_injection"] },
15457
- { method: "UUID", class: "uuid", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15458
- { method: "Decimal", class: "decimal", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15459
- // =========================================================================
15460
- // Cipher output taint barriers (#239 C4 residual)
15461
- // Symmetric/AEAD cipher output is high-entropy ciphertext bytes. The
15462
- // encoded form (hex / base64) cannot carry a text-injection payload:
15463
- // an attacker would need the plaintext to encrypt to a valid HTML /
15464
- // SQL / shell / path token, which is not achievable against a keyed
15465
- // block cipher. Applies to Node.js crypto.Cipher / Java javax.crypto.Cipher
15466
- // (both expose .update() and .final() / .doFinal()) — receiver-name
15467
- // heuristic in receiverMightBeClass() matches conventional `cipher`
15468
- // variable names as well as typed Cipher receivers.
15469
- // =========================================================================
15470
- { method: "update", class: "Cipher", removes: ["xss", "sql_injection", "command_injection", "path_traversal", "code_injection", "crlf", "log_injection", "ldap_injection", "xpath_injection"] },
15471
- { method: "final", class: "Cipher", removes: ["xss", "sql_injection", "command_injection", "path_traversal", "code_injection", "crlf", "log_injection", "ldap_injection", "xpath_injection"] },
15472
- { method: "doFinal", class: "Cipher", removes: ["xss", "sql_injection", "command_injection", "path_traversal", "code_injection", "crlf", "log_injection", "ldap_injection", "xpath_injection"] }
15473
- ];
15474
- var DEFAULT_SINK_SEMANTICS = [
15475
- {
15476
- signature: "Jedis#executeCommand",
15477
- real_class: "db_protocol",
15478
- overrides: ["command_injection", "code_injection"],
15479
- note: "Redis wire-protocol serialization, not OS exec"
15480
- },
15481
- {
15482
- signature: "Connection#executeCommand",
15483
- real_class: "db_protocol",
15484
- overrides: ["command_injection", "code_injection"],
15485
- note: "Jedis abstract Connection base"
15486
- },
15487
- {
15488
- signature: "JedisCluster#executeCommand",
15489
- real_class: "db_protocol",
15490
- overrides: ["command_injection", "code_injection"],
15491
- note: "Jedis cluster client"
15492
- },
15493
- {
15494
- signature: "Func1#exec",
15495
- real_class: "functional_dispatch",
15496
- overrides: ["command_injection", "code_injection"],
15497
- note: "RxJava functional dispatch, not OS exec"
15498
- },
15499
- {
15500
- signature: "Action0#call",
15501
- real_class: "functional_dispatch",
15502
- overrides: ["command_injection"],
15503
- note: "RxJava Action0 dispatch"
15504
- },
15505
- {
15506
- signature: "Action1#call",
15507
- real_class: "functional_dispatch",
15508
- overrides: ["command_injection"],
15509
- note: "RxJava Action1 dispatch"
15510
- },
15511
- {
15512
- signature: "Unsafe#defineAnonymousClass",
15513
- real_class: "jdk_internal",
15514
- overrides: ["code_injection"],
15515
- note: "sun.misc.Unsafe JDK-internal reflective bridge"
15516
- },
15517
- {
15518
- signature: "MethodHandle#invokeExact",
15519
- real_class: "jdk_internal",
15520
- overrides: ["code_injection"],
15521
- note: "java.lang.invoke.MethodHandle \u2014 JDK-internal"
15522
- }
15523
- ];
15524
- function getDefaultConfig() {
15525
- return {
15526
- sources: DEFAULT_SOURCES,
15527
- sinks: DEFAULT_SINKS,
15528
- sanitizers: DEFAULT_SANITIZERS,
15529
- sinkSemantics: DEFAULT_SINK_SEMANTICS
15530
- };
15531
- }
15532
-
15533
- // src/analysis/js-crlf-strip.ts
15534
- var MAX_PATTERN_LENGTH = 200;
15535
- var NEUTRAL_AFTER_REPLACE = /* @__PURE__ */ new Set([
15536
- "replace",
15537
- "replaceAll",
15538
- "trim",
15539
- "trimStart",
15540
- "trimEnd",
15541
- "toString",
15542
- "toLowerCase",
15543
- "toUpperCase",
15544
- "slice",
15545
- "substring"
15546
- ]);
15547
- var PROBE = "a\r\rb\n\nc\r\nd\n\re x ";
15548
- function readQuoted(s, i2) {
15549
- const q = s[i2];
15550
- if (q !== '"' && q !== "'" && q !== "`") return null;
15551
- let out2 = "";
15552
- for (let j = i2 + 1; j < s.length; j++) {
15553
- const c = s[j];
15554
- if (c === q) return { value: out2, end: j + 1 };
15555
- if (q === "`" && c === "$" && s[j + 1] === "{") return null;
15556
- if (c === "\\") {
15557
- const n = s[j + 1];
15558
- if (n === void 0) return null;
15559
- switch (n) {
15560
- case "n":
15561
- out2 += "\n";
15562
- j++;
15563
- continue;
15564
- case "r":
15565
- out2 += "\r";
15566
- j++;
15567
- continue;
15568
- case "t":
15569
- out2 += " ";
15570
- j++;
15571
- continue;
15572
- case "0":
15573
- out2 += "\0";
15574
- j++;
15575
- continue;
15576
- case "x": {
15577
- const h = /^[0-9a-fA-F]{2}/.exec(s.slice(j + 2, j + 4));
15578
- if (!h) return null;
15579
- out2 += String.fromCharCode(parseInt(h[0], 16));
15580
- j += 3;
15581
- continue;
15582
- }
15583
- case "u": {
15584
- const h = /^[0-9a-fA-F]{4}/.exec(s.slice(j + 2, j + 6));
15585
- if (!h) return null;
15586
- out2 += String.fromCharCode(parseInt(h[0], 16));
15587
- j += 5;
15588
- continue;
15589
- }
15590
- default:
15591
- out2 += n;
15592
- j++;
15593
- continue;
15594
- }
15595
- }
15596
- if (c === "\n" && q !== "`") return null;
15597
- out2 += c;
15598
- }
15599
- return null;
15600
- }
15601
- function readRegexLiteral(s, i2) {
15602
- if (s[i2] !== "/") return null;
15603
- let inClass = false;
15604
- for (let j = i2 + 1; j < s.length; j++) {
15605
- const c = s[j];
15606
- if (c === "\n") return null;
15607
- if (c === "\\") {
15608
- j++;
15609
- continue;
15610
- }
15611
- if (inClass) {
15612
- if (c === "]") inClass = false;
15613
- continue;
15614
- }
15615
- if (c === "[") {
15616
- inClass = true;
15617
- continue;
15618
- }
15619
- if (c === "/") {
15620
- const flags2 = /^[dgimsuvy]*/.exec(s.slice(j + 1))[0];
15621
- return { source: s.slice(i2 + 1, j), flags: flags2, end: j + 1 + flags2.length };
15622
- }
15623
- }
15624
- return null;
15625
- }
15626
- var skipWs = (s, i2) => {
15627
- while (i2 < s.length && /\s/.test(s[i2])) i2++;
15628
- return i2;
15629
- };
15630
- function parseSteps(chainText) {
15631
- const steps = [];
15632
- const callRe = /\.\s*(replaceAll|replace)\s*\(/g;
15633
- let m;
15634
- while ((m = callRe.exec(chainText)) !== null) {
15635
- const kind = m[1];
15636
- let i2 = skipWs(chainText, m.index + m[0].length);
15637
- let pattern;
15638
- const rx = readRegexLiteral(chainText, i2);
15639
- if (rx) {
15640
- if (rx.source.length > MAX_PATTERN_LENGTH) return null;
15641
- try {
15642
- pattern = new RegExp(rx.source, rx.flags);
15643
- } catch {
15644
- return null;
15645
- }
15646
- i2 = rx.end;
15647
- } else {
15648
- const str = readQuoted(chainText, i2);
15649
- if (!str) return null;
15650
- pattern = str.value;
15651
- i2 = str.end;
15652
- }
15653
- i2 = skipWs(chainText, i2);
15654
- if (chainText[i2] !== ",") return null;
15655
- i2 = skipWs(chainText, i2 + 1);
15656
- const rep = readQuoted(chainText, i2);
15657
- if (!rep) return null;
15658
- i2 = skipWs(chainText, rep.end);
15659
- if (chainText[i2] !== ")") return null;
15660
- steps.push({ kind, pattern, replacement: rep.value });
15661
- callRe.lastIndex = i2 + 1;
15662
- }
15663
- return steps;
15664
- }
15665
- function run2(steps, input) {
15666
- let s = input;
15667
- try {
15668
- for (const st of steps) {
15669
- if (st.kind === "replaceAll" && st.pattern instanceof RegExp && !st.pattern.global) return null;
15670
- s = st.kind === "replaceAll" ? s.replaceAll(st.pattern, st.replacement) : s.replace(st.pattern, st.replacement);
15671
- }
15672
- } catch {
15673
- return null;
15674
- }
15675
- return s;
15676
- }
15677
- function jsReplaceChainVerdict(chainText) {
15678
- const steps = parseSteps(chainText);
15679
- if (!steps || steps.length === 0) return "undecided";
15680
- const first = chainText.search(/\.\s*(?:replaceAll|replace)\s*\(/);
15681
- for (const seg of chainText.slice(first + 1).matchAll(/\.\s*([A-Za-z_$][\w$]*)\s*\(/g)) {
15682
- if (!NEUTRAL_AFTER_REPLACE.has(seg[1])) return "undecided";
15683
- }
15684
- const out2 = run2(steps, PROBE);
15685
- if (out2 === null) return "undecided";
15686
- return out2.includes("\r") || out2.includes("\n") ? "leaves-crlf" : "strips-crlf";
15687
- }
15688
- function jsChainTextAt(sourceLines, line, column) {
15689
- const text = [(sourceLines[line - 1] ?? "").slice(column), ...sourceLines.slice(line, line + 7)].join("\n");
15690
- let depth = 0;
15691
- let prevSig = "";
15692
- let i2 = 0;
15693
- for (; i2 < text.length; i2++) {
15694
- const c = text[i2];
15695
- if (c === '"' || c === "'" || c === "`") {
15696
- for (i2++; i2 < text.length && text[i2] !== c; i2++) if (text[i2] === "\\") i2++;
15697
- prevSig = c;
15698
- continue;
15699
- }
15700
- if (c === "/" && depth > 0 && (prevSig === "(" || prevSig === ",")) {
15701
- const rx = readRegexLiteral(text, i2);
15702
- if (rx) {
15703
- i2 = rx.end - 1;
15704
- prevSig = "/";
15705
- continue;
15706
- }
15707
- }
15708
- if (c === "(" || c === "[" || c === "{") {
15709
- depth++;
15710
- prevSig = c;
15711
- continue;
15712
- }
15713
- if (c === ")" || c === "]" || c === "}") {
15714
- if (depth === 0) break;
15715
- depth--;
15716
- prevSig = c;
15717
- continue;
15718
- }
15719
- if (depth === 0 && !/[\w$.\s]/.test(c)) break;
15720
- if (!/\s/.test(c)) prevSig = c;
15829
+ // Bounded to URL-context sinks. Class-scoped to the specific
15830
+ // `urllib.parse` receiver to avoid colliding with unrelated bare
15831
+ // `quote(...)` calls in other libraries.
15832
+ { method: "quote", class: "urllib.parse", removes: ["ssrf", "open_redirect", "xss", "path_traversal"] },
15833
+ { method: "quote_plus", class: "urllib.parse", removes: ["ssrf", "open_redirect", "xss", "path_traversal"] },
15834
+ { method: "urlencode", class: "urllib.parse", removes: ["ssrf", "open_redirect", "xss"] },
15835
+ // Bare aliases — `from urllib.parse import quote` then unqualified.
15836
+ { method: "quote_plus", removes: ["ssrf", "open_redirect", "xss", "path_traversal"] },
15837
+ { method: "urlencode", removes: ["ssrf", "open_redirect", "xss"] },
15838
+ // `quote` bare is intentionally NOT registered — it collides with
15839
+ // shlex.quote (bare-imported) which is a command_injection sanitizer,
15840
+ // not a URL sanitizer. The class-scoped variant above catches the
15841
+ // qualified `urllib.parse.quote(...)` shape; unqualified callers who
15842
+ // want URL-context credit should use `quote_plus` (which does not
15843
+ // collide with any command_injection sanitizer).
15844
+ // Python XSS — additional common sanitizers.
15845
+ //
15846
+ // bleach.clean(...) — already covered above (line 2898)
15847
+ // bleach.linkify(...) — turns URLs into anchor tags; sanitizes as well
15848
+ // django.utils.html.escape / strip_tags — Django's XSS escape helpers
15849
+ // jinja2.escape — Jinja2's Markup escape (aliased from markupsafe)
15850
+ // flask.escape — Flask re-export of markupsafe.escape
15851
+ // saxutils.escape — stdlib xml.sax.saxutils.escape for XML docs
15852
+ { method: "linkify", class: "bleach", removes: ["xss"] },
15853
+ // Bare `linkify(...)` alias — `from bleach import linkify`.
15854
+ { method: "linkify", removes: ["xss"] },
15855
+ { method: "escape", class: "django.utils.html", removes: ["xss"] },
15856
+ { method: "strip_tags", class: "django.utils.html", removes: ["xss"] },
15857
+ { method: "escape", class: "jinja2", removes: ["xss"] },
15858
+ { method: "escape", class: "flask", removes: ["xss"] },
15859
+ { method: "escape", class: "saxutils", removes: ["xss"] },
15860
+ { method: "escape", class: "xml.sax.saxutils", removes: ["xss"] },
15861
+ { method: "quoteattr", class: "saxutils", removes: ["xss"] },
15862
+ { method: "quoteattr", class: "xml.sax.saxutils", removes: ["xss"] },
15863
+ // Python ReDoS — `re.escape(user)` when building a regex from user input
15864
+ // strips regex metacharacters. Downstream `re.compile / re.match` cannot
15865
+ // interpret user-supplied alternations or quantifiers. Also covers the
15866
+ // `code_injection` categorization that `re.compile` currently emits
15867
+ // (a re.escape-wrapped pattern cannot execute anything, so both are safe).
15868
+ { method: "escape", class: "re", removes: ["redos", "code_injection"] },
15869
+ // Python SQLAlchemy — `text(...).bindparams(...)` binds params safely.
15870
+ // The `bindparams` call is the sanitizer; the parent `text` wraps the
15871
+ // template. Also add `expression.literal` for explicit SQL literals.
15872
+ { method: "bindparams", removes: ["sql_injection"] },
15873
+ // psycopg2 sql-composition helpers
15874
+ { method: "Identifier", class: "sql", removes: ["sql_injection"] },
15875
+ { method: "Literal", class: "sql", removes: ["sql_injection"] },
15876
+ { method: "Placeholder", class: "sql", removes: ["sql_injection"] },
15877
+ // =========================================================================
15878
+ // Rust Sanitizers
15879
+ // =========================================================================
15880
+ // Rust SQL - sqlx query! macro is compile-time checked (parameterized)
15881
+ { method: "query!", removes: ["sql_injection"] },
15882
+ { method: "query_as!", removes: ["sql_injection"] },
15883
+ { method: "query_scalar!", removes: ["sql_injection"] },
15884
+ { method: "query_unchecked!", removes: ["sql_injection"] },
15885
+ // Diesel DSL (type-safe query builder)
15886
+ { method: "filter", class: "diesel", removes: ["sql_injection"] },
15887
+ { method: "eq", class: "diesel", removes: ["sql_injection"] },
15888
+ // Rust Path Traversal - basename/file_name extracts just the filename
15889
+ { method: "file_name", removes: ["path_traversal"] },
15890
+ { method: "file_stem", removes: ["path_traversal"] },
15891
+ { method: "extension", removes: ["path_traversal"] },
15892
+ { method: "canonicalize", removes: ["path_traversal"] },
15893
+ // Resolves symlinks, validates path exists
15894
+ // Rust Command Injection - allowlist validation
15895
+ { method: "contains", removes: ["command_injection", "ssrf", "open_redirect"] },
15896
+ // Used for allowlist checks
15897
+ { method: "starts_with", removes: ["path_traversal", "ssrf", "open_redirect"] },
15898
+ // Path/URL prefix validation
15899
+ { method: "ends_with", removes: ["path_traversal", "open_redirect"] },
15900
+ // Rust XSS - HTML escaping
15901
+ { method: "escape", class: "html_escape", removes: ["xss"] },
15902
+ { method: "encode_text", class: "html_escape", removes: ["xss"] },
15903
+ { method: "encode_attribute", class: "html_escape", removes: ["xss"] },
15904
+ { method: "escape_html", removes: ["xss"] },
15905
+ // Rust Type coercion (parsing)
15906
+ { method: "parse", removes: ["sql_injection", "command_injection", "xss"] },
15907
+ // str.parse::<i32>()
15908
+ // =========================================================================
15909
+ // Type-cast taint barriers (#57)
15910
+ // Numeric/UUID casts cannot carry a string-injection payload.
15911
+ // =========================================================================
15912
+ // Java numeric parse — Integer.parseInt, Long.parseLong, etc.
15913
+ { method: "parseInt", class: "Integer", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15914
+ { method: "parseLong", class: "Long", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15915
+ { method: "parseFloat", class: "Float", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15916
+ { method: "parseDouble", class: "Double", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15917
+ { method: "parseShort", class: "Short", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15918
+ { method: "parseByte", class: "Byte", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15919
+ // cognium-dev #238 A.3 — parseBoolean and expanded coercion coverage for XSS/CRLF/log/xpath/ldap/xxe.
15920
+ // A parsed boolean/numeric cannot carry a string-injection payload for any string-based sink.
15921
+ { method: "parseBoolean", class: "Boolean", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection", "xss", "crlf", "log_injection", "xpath_injection", "ldap_injection", "xxe"] },
15922
+ // Java UUID parse — UUID.fromString rejects non-UUID strings
15923
+ { method: "fromString", class: "UUID", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15924
+ // JavaScript numeric coercion (Number/parseInt/parseFloat already covered above; add path_traversal/code_injection)
15925
+ { method: "BigInt", removes: ["sql_injection", "nosql_injection", "command_injection", "path_traversal", "code_injection"] },
15926
+ // Go numeric parse — strconv.Atoi, ParseInt, ParseFloat, ParseUint, ParseBool
15927
+ { method: "Atoi", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15928
+ { method: "ParseInt", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15929
+ { method: "ParseFloat", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15930
+ { method: "ParseUint", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15931
+ { method: "ParseBool", class: "strconv", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15932
+ // Go UUID parse
15933
+ { method: "Parse", class: "uuid", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15934
+ { method: "MustParse", class: "uuid", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15935
+ // Python — int/float already covered above; add bool + UUID/Decimal casts
15936
+ { method: "bool", removes: ["sql_injection", "command_injection", "xss", "code_injection"] },
15937
+ { method: "UUID", class: "uuid", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15938
+ { method: "Decimal", class: "decimal", removes: ["sql_injection", "command_injection", "path_traversal", "code_injection"] },
15939
+ // =========================================================================
15940
+ // Cipher output taint barriers (#239 C4 residual)
15941
+ // Symmetric/AEAD cipher output is high-entropy ciphertext bytes. The
15942
+ // encoded form (hex / base64) cannot carry a text-injection payload:
15943
+ // an attacker would need the plaintext to encrypt to a valid HTML /
15944
+ // SQL / shell / path token, which is not achievable against a keyed
15945
+ // block cipher. Applies to Node.js crypto.Cipher / Java javax.crypto.Cipher
15946
+ // (both expose .update() and .final() / .doFinal()) — receiver-name
15947
+ // heuristic in receiverMightBeClass() matches conventional `cipher`
15948
+ // variable names as well as typed Cipher receivers.
15949
+ // =========================================================================
15950
+ { method: "update", class: "Cipher", removes: ["xss", "sql_injection", "command_injection", "path_traversal", "code_injection", "crlf", "log_injection", "ldap_injection", "xpath_injection"] },
15951
+ { method: "final", class: "Cipher", removes: ["xss", "sql_injection", "command_injection", "path_traversal", "code_injection", "crlf", "log_injection", "ldap_injection", "xpath_injection"] },
15952
+ { method: "doFinal", class: "Cipher", removes: ["xss", "sql_injection", "command_injection", "path_traversal", "code_injection", "crlf", "log_injection", "ldap_injection", "xpath_injection"] }
15953
+ ];
15954
+ var DEFAULT_SINK_SEMANTICS = [
15955
+ {
15956
+ signature: "Jedis#executeCommand",
15957
+ real_class: "db_protocol",
15958
+ overrides: ["command_injection", "code_injection"],
15959
+ note: "Redis wire-protocol serialization, not OS exec"
15960
+ },
15961
+ {
15962
+ signature: "Connection#executeCommand",
15963
+ real_class: "db_protocol",
15964
+ overrides: ["command_injection", "code_injection"],
15965
+ note: "Jedis abstract Connection base"
15966
+ },
15967
+ {
15968
+ signature: "JedisCluster#executeCommand",
15969
+ real_class: "db_protocol",
15970
+ overrides: ["command_injection", "code_injection"],
15971
+ note: "Jedis cluster client"
15972
+ },
15973
+ {
15974
+ signature: "Func1#exec",
15975
+ real_class: "functional_dispatch",
15976
+ overrides: ["command_injection", "code_injection"],
15977
+ note: "RxJava functional dispatch, not OS exec"
15978
+ },
15979
+ {
15980
+ signature: "Action0#call",
15981
+ real_class: "functional_dispatch",
15982
+ overrides: ["command_injection"],
15983
+ note: "RxJava Action0 dispatch"
15984
+ },
15985
+ {
15986
+ signature: "Action1#call",
15987
+ real_class: "functional_dispatch",
15988
+ overrides: ["command_injection"],
15989
+ note: "RxJava Action1 dispatch"
15990
+ },
15991
+ {
15992
+ signature: "Unsafe#defineAnonymousClass",
15993
+ real_class: "jdk_internal",
15994
+ overrides: ["code_injection"],
15995
+ note: "sun.misc.Unsafe JDK-internal reflective bridge"
15996
+ },
15997
+ {
15998
+ signature: "MethodHandle#invokeExact",
15999
+ real_class: "jdk_internal",
16000
+ overrides: ["code_injection"],
16001
+ note: "java.lang.invoke.MethodHandle \u2014 JDK-internal"
15721
16002
  }
15722
- return text.slice(0, i2);
16003
+ ];
16004
+ function getDefaultConfig() {
16005
+ return {
16006
+ sources: DEFAULT_SOURCES,
16007
+ sinks: DEFAULT_SINKS,
16008
+ sanitizers: DEFAULT_SANITIZERS,
16009
+ sinkSemantics: DEFAULT_SINK_SEMANTICS
16010
+ };
15723
16011
  }
15724
16012
 
15725
16013
  // src/analysis/constant-propagation/patterns.ts
@@ -16111,13 +16399,35 @@ function dropCSharpObjectCarriedWaypoints(sinks, calls) {
16111
16399
  function analyzeTaint(calls, types, config = getDefaultConfig(), typeHierarchy, language, code, imports) {
16112
16400
  const sourceLines = code !== void 0 ? code.split("\n") : void 0;
16113
16401
  const sources = findSources(calls, types, config.sources, sourceLines, language, imports);
16114
- let sinkPatterns = expandPromisifyAliases(config.sinks, sourceLines, language);
16402
+ let sinkPatterns = config.sinks.filter((p) => sinkPatternImportApplies(p, imports));
16403
+ sinkPatterns = expandPromisifyAliases(sinkPatterns, sourceLines, language);
16115
16404
  sinkPatterns = expandIndirectEvalAliases(sinkPatterns, sourceLines, language);
16116
16405
  const sinks = findSinks(calls, sinkPatterns, typeHierarchy, language, sourceLines, types);
16117
16406
  const gatedSinks = language === "csharp" ? dropCSharpObjectCarriedWaypoints(sinks, calls) : sinks;
16118
16407
  const sanitizers = findSanitizers(calls, types, config.sanitizers, sourceLines, language);
16119
16408
  return { sources, sinks: gatedSinks, sanitizers };
16120
16409
  }
16410
+ function isBoundParameterCall(call, pattern, sourceLines) {
16411
+ if (!pattern.requires_import || pattern.type !== "sql_injection") return false;
16412
+ const first = call.arguments[0]?.expression?.trim() ?? "";
16413
+ if (first.startsWith("[") || first.startsWith("{")) return true;
16414
+ const receiver = call.receiver;
16415
+ if (!receiver || !sourceLines || !/^[A-Za-z_$][\w$]*$/.test(receiver)) return false;
16416
+ const assignedFromPrepare = new RegExp(
16417
+ `\\b${receiver.replace(/\$/g, "\\$")}\\s*(?::[^=]+)?=\\s*(?:await\\s+)?[\\w$.]+\\.prepare\\s*\\(`
16418
+ );
16419
+ return sourceLines.some((line) => assignedFromPrepare.test(line));
16420
+ }
16421
+ function sinkPatternImportApplies(pattern, imports) {
16422
+ const required = pattern.requires_import;
16423
+ if (!required || required.length === 0) return true;
16424
+ if (!imports || imports.length === 0) return false;
16425
+ return imports.some((imp) => {
16426
+ const from = imp.from_package;
16427
+ if (!from) return false;
16428
+ return required.some((m) => from === m || from.startsWith(m + "/"));
16429
+ });
16430
+ }
16121
16431
  function sinkPatternAppliesTo(pattern, language) {
16122
16432
  if (language === void 0) return true;
16123
16433
  if (pattern.languages && pattern.languages.length > 0 && !pattern.languages.includes(language)) {
@@ -16343,7 +16653,14 @@ function findSources(calls, types, patterns, sourceLines, language, imports) {
16343
16653
  }
16344
16654
  const propertyPatterns = patterns.filter((p) => p.property && p.object && p.property_tainted);
16345
16655
  const hasPropertyPatterns = propertyPatterns.length > 0;
16656
+ const jsCode = (language === "javascript" || language === "typescript") && sourceLines ? sourceLines.join("\n") : void 0;
16657
+ const noParamHelper = /* @__PURE__ */ new Map();
16346
16658
  for (const call of calls) {
16659
+ if (jsCode !== void 0 && !call.receiver) {
16660
+ let drop = noParamHelper.get(call.method_name);
16661
+ if (drop === void 0) noParamHelper.set(call.method_name, drop = jsHelperReturnsNoParam(jsCode, call.method_name));
16662
+ if (drop) continue;
16663
+ }
16347
16664
  for (const arg of call.arguments) {
16348
16665
  if (arg.expression) {
16349
16666
  const taintCheck = isJavaScriptTaintedArgument(arg.expression, hasPropertyPatterns ? patterns : void 0);
@@ -16535,6 +16852,46 @@ function isInterproceduralTaintableType(typeName, language) {
16535
16852
  const leaf = baseType.split(".").pop() ?? baseType;
16536
16853
  if (csharpTaintable.includes(baseType) || csharpTaintable.includes(leaf)) return true;
16537
16854
  }
16855
+ if (language === "rust") {
16856
+ const trimmed = typeName.trim();
16857
+ const unref = trimmed.replace(/^&mut\s+/, "").replace(/^&\s*/, "");
16858
+ const rustBase = unref.split("<")[0].trim();
16859
+ const rustScalars = [
16860
+ "String",
16861
+ "str",
16862
+ "bool",
16863
+ "char",
16864
+ "i8",
16865
+ "i16",
16866
+ "i32",
16867
+ "i64",
16868
+ "i128",
16869
+ "isize",
16870
+ "u8",
16871
+ "u16",
16872
+ "u32",
16873
+ "u64",
16874
+ "u128",
16875
+ "usize",
16876
+ "f32",
16877
+ "f64"
16878
+ ];
16879
+ if (rustScalars.includes(rustBase)) return true;
16880
+ if (rustBase === "()" || rustBase === "!") return false;
16881
+ if (unref.startsWith("Vec<") || unref.startsWith("Option<") || unref.startsWith("Result<")) {
16882
+ return true;
16883
+ }
16884
+ if (/^[A-Z][A-Za-z0-9_]*$/.test(rustBase)) return true;
16885
+ }
16886
+ if (language === "javascript" || language === "typescript") {
16887
+ const trimmed = typeName.trim();
16888
+ const jsScalars = ["string", "number", "boolean", "bigint", "any", "unknown", "object"];
16889
+ if (jsScalars.includes(baseType)) return true;
16890
+ if (trimmed.startsWith("{") || trimmed.startsWith("[") || trimmed.startsWith("(")) return true;
16891
+ if (/\bRecord\s*</.test(trimmed)) return true;
16892
+ if (["void", "undefined", "null", "never"].includes(baseType)) return false;
16893
+ if (/^[A-Za-z_][\w.$]*$/.test(baseType)) return true;
16894
+ }
16538
16895
  if (typeName.endsWith("[]")) {
16539
16896
  const elementType = typeName.slice(0, -2);
16540
16897
  if (elementType === "String" || elementType === "Object" || elementType === "byte") {
@@ -16649,6 +17006,31 @@ function isSafeGoExecCommandCall(call, pattern, language) {
16649
17006
  return false;
16650
17007
  }
16651
17008
  }
17009
+ if (program === "git") {
17010
+ const subcommandArgPos = pattern.method === "CommandContext" ? 2 : 1;
17011
+ const subcommandArg = call.arguments.find((a) => a.position === subcommandArgPos);
17012
+ let subcommand;
17013
+ if (subcommandArg?.literal !== null && subcommandArg?.literal !== void 0) {
17014
+ subcommand = String(subcommandArg.literal);
17015
+ } else {
17016
+ const expr = (subcommandArg?.expression ?? "").trim();
17017
+ if (expr.startsWith('"') || expr.startsWith("`") || expr.startsWith("'")) {
17018
+ subcommand = expr.slice(1, -1);
17019
+ }
17020
+ }
17021
+ if (subcommand === "ls-remote") {
17022
+ const hasEndOfOptions = call.arguments.some((a) => {
17023
+ if (a.literal !== null && a.literal !== void 0) {
17024
+ return String(a.literal) === "--";
17025
+ }
17026
+ const expr = (a.expression ?? "").trim();
17027
+ return expr === '"--"' || expr === "'--'" || expr === "`--`";
17028
+ });
17029
+ if (!hasEndOfOptions) {
17030
+ return false;
17031
+ }
17032
+ }
17033
+ }
16652
17034
  return true;
16653
17035
  }
16654
17036
  function isSafeJSChildProcessCall(call, pattern, language) {
@@ -17049,8 +17431,52 @@ function isRegexReceiver(receiver, sourceLines) {
17049
17431
  if (r.startsWith("/") && /\/[a-z]*$/.test(r)) return true;
17050
17432
  if (/^(?:new\s+)?RegExp\s*\(/.test(r)) return true;
17051
17433
  if (!/^[A-Za-z_$][\w$]*$/.test(r) || !sourceLines) return false;
17052
- const decl = new RegExp(`(?:const|let|var)\\s+${escapeRe(r)}\\s*=\\s*(?:/|(?:new\\s+)?RegExp\\s*\\()`);
17053
- return sourceLines.some((l) => decl.test(l));
17434
+ const n = escapeRe(r);
17435
+ const decl = new RegExp(`(?:const|let|var)\\s+${n}\\s*(?::\\s*RegExp\\s*)?=\\s*(?:/|(?:new\\s+)?RegExp\\s*\\()`);
17436
+ if (sourceLines.some((l) => decl.test(l))) return true;
17437
+ const wrapped = new RegExp(`(?:const|let|var)\\s+${n}\\s*(?::\\s*RegExp\\s*)?=\\s*$`);
17438
+ const typed = new RegExp(`\\b${n}\\s*[?!]?\\s*:\\s*RegExp\\b`);
17439
+ return sourceLines.some((l, i2) => typed.test(l) || wrapped.test(l) && /^\s*(?:\/|(?:new\s+)?RegExp\s*\()/.test(sourceLines[i2 + 1] ?? ""));
17440
+ }
17441
+ var DB_TYPE_NAME = /(?:connection|database|\bdb\b|db$|^db|pool|client|knex|sql|statement|prisma|sequelize|repository|transaction|query|store)/i;
17442
+ function isTypedNonDbReceiver(receiver, sourceLines) {
17443
+ const raw = (receiver ?? "").trim();
17444
+ if (!raw || !sourceLines) return false;
17445
+ const lastDot = raw.lastIndexOf(".");
17446
+ const name2 = (lastDot >= 0 ? raw.slice(lastDot + 1) : raw).trim();
17447
+ if (!/^[A-Za-z_$][\w$]*$/.test(name2) || DB_TYPE_NAME.test(name2)) return false;
17448
+ const decl = raw.startsWith("this.") ? new RegExp(`^\\s*(?:(?:private|protected|public|readonly|static|declare)\\s+)+${escapeRe(name2)}\\s*[?!]?\\s*:\\s*([A-Za-z_$][\\w$]*)\\s*[;=]`) : new RegExp(`\\b${escapeRe(name2)}\\s*\\??\\s*:\\s*([A-Za-z_$][\\w$]*)\\s*[;,)=]`);
17449
+ let typed;
17450
+ for (const l of sourceLines) {
17451
+ const m = decl.exec(l);
17452
+ if (!m) continue;
17453
+ if (typed !== void 0 && typed !== m[1]) return false;
17454
+ typed = m[1];
17455
+ }
17456
+ return typed !== void 0 && !DB_TYPE_NAME.test(typed) && !/^(?:any|unknown|object)$/.test(typed);
17457
+ }
17458
+ function isNavigationReceiverName(receiver) {
17459
+ const r = (receiver ?? "").trim();
17460
+ if (!r) return false;
17461
+ const last = r.slice(r.lastIndexOf(".") + 1).replace(/\(\)$/, "");
17462
+ return /router|history|navigat|^nav$/i.test(last);
17463
+ }
17464
+ function isInMemoryMapGetReceiver(receiver, sourceLines) {
17465
+ const raw = (receiver ?? "").trim();
17466
+ if (!raw || !sourceLines) return false;
17467
+ if (/\.properties$/i.test(raw)) return true;
17468
+ const lastDot = raw.lastIndexOf(".");
17469
+ const r = (lastDot >= 0 ? raw.slice(lastDot + 1) : raw).trim();
17470
+ if (/^(properties|memoryCache)$/i.test(r)) return true;
17471
+ if (!/^[A-Za-z_$][\w$]*$/.test(r)) return false;
17472
+ const n = escapeRe(r);
17473
+ const mapCtor = new RegExp(
17474
+ `\\b${n}\\s*(?::[^=;]*)?=\\s*new\\s+(?:Weak)?Map\\s*(?:<.*>)?\\s*\\(`
17475
+ );
17476
+ const mapType = new RegExp(
17477
+ `\\b${n}\\s*\\??\\s*:\\s*(?:Readonly)?(?:Weak)?Map\\s*<`
17478
+ );
17479
+ return sourceLines.some((l) => mapCtor.test(l) || mapType.test(l));
17054
17480
  }
17055
17481
  function isDeclaredFunctionReference(arg, sourceLines) {
17056
17482
  if (arg.literal !== null && arg.literal !== void 0) return false;
@@ -17064,7 +17490,10 @@ function isDeclaredFunctionReference(arg, sourceLines) {
17064
17490
  // const connect = () => / function / async () =>
17065
17491
  new RegExp(
17066
17492
  `\\b(?:const|let|var)\\s+${n}\\s*=\\s*(?:async\\s+)?(?:function\\b|\\(|[A-Za-z_$][\\w$]*\\s*=>)`
17067
- )
17493
+ ),
17494
+ // A Promise executor's resolve / reject: `new Promise((r) => setTimeout(r, ms))`,
17495
+ // the sleep idiom (dogfood 2026-10-31, controldeck harness).
17496
+ new RegExp(`\\bnew\\s+Promise\\s*(?:<[^>]*>)?\\s*\\(\\s*(?:async\\s+)?(?:\\(\\s*(?:[A-Za-z_$][\\w$]*\\s*,\\s*)?${n}\\s*[,)]|${n}\\s*=>|function\\s*\\(\\s*(?:[A-Za-z_$][\\w$]*\\s*,\\s*)?${n}\\s*[,)])`)
17068
17497
  ];
17069
17498
  return sourceLines.some((l) => decls.some((re) => re.test(l)));
17070
17499
  }
@@ -17256,6 +17685,12 @@ function findSinks(calls, patterns, typeHierarchy, language, sourceLines, types)
17256
17685
  if (isParameterizedQueryCall(call, pattern)) {
17257
17686
  continue;
17258
17687
  }
17688
+ if ((language === "javascript" || language === "typescript") && (pattern.type === "sql_injection" || pattern.type === "nosql_injection") && call.arguments.length === 0 && pattern.arg_positions.every((p) => p >= 0)) {
17689
+ continue;
17690
+ }
17691
+ if (isBoundParameterCall(call, pattern, sourceLines)) {
17692
+ continue;
17693
+ }
17259
17694
  if (isSafePythonSubprocessCall(call, pattern, language)) {
17260
17695
  continue;
17261
17696
  }
@@ -17313,9 +17748,18 @@ function findSinks(calls, patterns, typeHierarchy, language, sourceLines, types)
17313
17748
  if (isArgumentlessJsResponseWriter(call, pattern, language)) {
17314
17749
  continue;
17315
17750
  }
17751
+ if (pattern.type === "open_redirect" && (language === "javascript" || language === "typescript") && (call.method_name === "push" || call.method_name === "replace") && (pattern.class ?? "").toLowerCase() === "router" && !call.receiver_type && !call.receiver_type_fqn && !isNavigationReceiverName(call.receiver)) {
17752
+ continue;
17753
+ }
17316
17754
  if ((pattern.type === "command_injection" || pattern.type === "sql_injection") && call.method_name === "exec" && (language === "javascript" || language === "typescript") && isRegexReceiver(call.receiver, sourceLines)) {
17317
17755
  continue;
17318
17756
  }
17757
+ if (pattern.type === "sql_injection" && call.method_name === "get" && pattern.class === "Connection" && (language === "javascript" || language === "typescript") && (isInMemoryMapGetReceiver(call.receiver, sourceLines) || isTypedNonDbReceiver(call.receiver, sourceLines))) {
17758
+ continue;
17759
+ }
17760
+ if (call.method_name === "get" && (language === "javascript" || language === "typescript") && isInMemoryMapGetReceiver(call.receiver, sourceLines)) {
17761
+ continue;
17762
+ }
17319
17763
  if (pattern.type === "code_injection" && language === "python" && call.method_name === "compile" && call.receiver && call.receiver !== "builtins") {
17320
17764
  continue;
17321
17765
  }
@@ -17332,7 +17776,7 @@ function findSinks(calls, patterns, typeHierarchy, language, sourceLines, types)
17332
17776
  continue;
17333
17777
  }
17334
17778
  const location = formatCallLocation(call);
17335
- const key = `${location}:${call.location.line}:${pattern.cwe}`;
17779
+ const key = `${location}:${call.location.line}:${call.location.column}:${pattern.cwe}`;
17336
17780
  const confidence = calculateSinkConfidence(call, pattern);
17337
17781
  const existing = sinkMap.get(key);
17338
17782
  if (!existing || confidence > existing.confidence) {
@@ -17343,6 +17787,7 @@ function findSinks(calls, patterns, typeHierarchy, language, sourceLines, types)
17343
17787
  cwe: pattern.cwe,
17344
17788
  location,
17345
17789
  line: call.location.line,
17790
+ callColumn: call.location.column,
17346
17791
  confidence,
17347
17792
  method: call.method_name,
17348
17793
  argPositions: pattern.arg_positions,
@@ -17380,6 +17825,15 @@ function matchesSourcePattern(call, pattern, language, types, imports) {
17380
17825
  return false;
17381
17826
  }
17382
17827
  }
17828
+ if (!pattern.class && pattern.return_tainted && pattern.method && (language === "javascript" || language === "typescript")) {
17829
+ const expressRequestAccessors = /* @__PURE__ */ new Set(["query", "body", "params", "headers", "cookies"]);
17830
+ if (expressRequestAccessors.has(pattern.method)) {
17831
+ const recv = call.receiver?.toLowerCase() ?? "";
17832
+ if (recv !== "req" && recv !== "request" && recv !== "ctx") {
17833
+ return false;
17834
+ }
17835
+ }
17836
+ }
17383
17837
  return pattern.return_tainted === true;
17384
17838
  }
17385
17839
  return false;
@@ -17473,6 +17927,7 @@ var SAFE_RECEIVERS_BY_METHOD = {
17473
17927
  "database",
17474
17928
  "sqlite",
17475
17929
  "conn",
17930
+ "con",
17476
17931
  "connection",
17477
17932
  "client",
17478
17933
  "pool",
@@ -17749,7 +18204,7 @@ function matchesSinkPattern(call, pattern, typeHierarchy, language) {
17749
18204
  }
17750
18205
  }
17751
18206
  }
17752
- if (!pattern.class && call.receiver) {
18207
+ if (!pattern.class && call.receiver && !pattern.requires_import) {
17753
18208
  if (isKnownSafeReceiverForMethod(call.receiver, call.method_name, pattern.type)) {
17754
18209
  return false;
17755
18210
  }
@@ -18482,6 +18937,8 @@ function javaReplaceChainCredit(chainText) {
18482
18937
  let lf = false;
18483
18938
  let lt = false;
18484
18939
  let gt = false;
18940
+ let openBrace = false;
18941
+ let closeBrace = false;
18485
18942
  for (const m of chainText.matchAll(JAVA_REPLACE_ARGS_RE)) {
18486
18943
  const kind = m[1];
18487
18944
  const rawFrom = m[2] ?? m[3] ?? "";
@@ -18492,10 +18949,13 @@ function javaReplaceChainCredit(chainText) {
18492
18949
  if (cov.lf) lf = true;
18493
18950
  if (from === "<" && to.startsWith("&")) lt = true;
18494
18951
  if (from === ">" && to.startsWith("&")) gt = true;
18952
+ if (from === "{") openBrace = true;
18953
+ if (from === "}") closeBrace = true;
18495
18954
  }
18496
18955
  const out2 = [];
18497
18956
  if (cr && lf) out2.push("log_injection");
18498
18957
  if (lt && gt) out2.push("xss");
18958
+ if (openBrace && closeBrace) out2.push("code_injection");
18499
18959
  return out2;
18500
18960
  }
18501
18961
  function matchesSanitizerPattern(call, pattern) {
@@ -20609,6 +21069,9 @@ var ConstantPropagator = class _ConstantPropagator {
20609
21069
  case "assignment_statement":
20610
21070
  this.handleGoAssignment(node);
20611
21071
  return false;
21072
+ case "var_declaration":
21073
+ this.handleGoVarDeclaration(node);
21074
+ return false;
20612
21075
  case "update_expression":
20613
21076
  this.handleUpdateExpression(node);
20614
21077
  return false;
@@ -21016,6 +21479,64 @@ var ConstantPropagator = class _ConstantPropagator {
21016
21479
  * helper that always returns a constant — clears the variable. Anything else stops being tracked here, which is what Go
21017
21480
  * assignments got before this handler existed: the DFG decides.
21018
21481
  */
21482
+ /** `var x = expr` / `var x T = expr` — same clean/taint rules as `:=` (#783). */
21483
+ handleGoVarDeclaration(node) {
21484
+ for (let i2 = 0; i2 < node.childCount; i2++) {
21485
+ const spec = node.child(i2);
21486
+ if (!spec || spec.type !== "var_spec") continue;
21487
+ const nameNode = spec.childForFieldName("name");
21488
+ let valueNode = spec.childForFieldName("value");
21489
+ if (!nameNode || !valueNode) continue;
21490
+ const names = [];
21491
+ if (nameNode.type === "identifier") {
21492
+ names.push(getNodeText2(nameNode, this.source));
21493
+ } else if (nameNode.type === "identifier_list") {
21494
+ for (const c of nameNode.children) {
21495
+ if (c.type === "identifier") names.push(getNodeText2(c, this.source));
21496
+ }
21497
+ }
21498
+ if (valueNode.type === "expression_list") {
21499
+ valueNode = valueNode.children.find((c) => c.type !== "," && c.type !== "comment") ?? valueNode;
21500
+ }
21501
+ if (names.length === 0) continue;
21502
+ const line = getNodeLine(node);
21503
+ for (const varName of names) {
21504
+ if (varName === "_") continue;
21505
+ const scopedName = this.getScopedName(varName);
21506
+ this.goScopedNames.add(scopedName);
21507
+ if (this.isTaintedExpression(valueNode)) {
21508
+ this.goUnknownVars.add(scopedName);
21509
+ this.tainted.add(scopedName);
21510
+ this.sanitizedVars.delete(scopedName);
21511
+ this.sanitizedVarUncovered.delete(scopedName);
21512
+ this.definitionNodes.set(scopedName, valueNode);
21513
+ this.symbols.set(scopedName, createUnknown(line));
21514
+ continue;
21515
+ }
21516
+ if (!this.isGoKnownCleanRhs(valueNode) || this.goUnknownVars.has(scopedName)) {
21517
+ this.goUnknownVars.add(scopedName);
21518
+ this.symbols.delete(scopedName);
21519
+ this.sanitizedVars.delete(scopedName);
21520
+ this.sanitizedVarUncovered.delete(scopedName);
21521
+ if (!this.inConditionalBranch) {
21522
+ this.tainted.delete(scopedName);
21523
+ this.definitionNodes.delete(scopedName);
21524
+ }
21525
+ continue;
21526
+ }
21527
+ if (this.inConditionalBranch) {
21528
+ this.goUnknownVars.add(scopedName);
21529
+ this.symbols.delete(scopedName);
21530
+ continue;
21531
+ }
21532
+ this.tainted.delete(scopedName);
21533
+ this.definitionNodes.delete(scopedName);
21534
+ this.symbols.set(scopedName, this.evaluateExpression(valueNode));
21535
+ this.sanitizedVars.delete(scopedName);
21536
+ this.sanitizedVarUncovered.delete(scopedName);
21537
+ }
21538
+ }
21539
+ }
21019
21540
  handleGoAssignment(node) {
21020
21541
  const left = node.childForFieldName("left");
21021
21542
  const right = node.childForFieldName("right");
@@ -21832,6 +22353,24 @@ var ConstantPropagator = class _ConstantPropagator {
21832
22353
  cache.set(rootId, false);
21833
22354
  return false;
21834
22355
  }
22356
+ /** Is an argument of `call` an inline sanitizer call over tainted input (itself possibly nested)? */
22357
+ argIsSanitizedTaint(call) {
22358
+ const argsNode = call.childForFieldName("arguments");
22359
+ if (!argsNode) return false;
22360
+ for (const arg of argsNode.children) {
22361
+ if (arg.type !== "method_invocation") continue;
22362
+ const name2 = arg.childForFieldName("name");
22363
+ if (!name2 || !SANITIZER_METHODS.has(getNodeText2(name2, this.source))) continue;
22364
+ const inner = arg.childForFieldName("arguments");
22365
+ if (!inner) continue;
22366
+ for (const a of inner.children) {
22367
+ if (a.type === "(" || a.type === ")" || a.type === ",") continue;
22368
+ if (this.isTaintedExpression(a)) return true;
22369
+ }
22370
+ if (this.argIsSanitizedTaint(arg)) return true;
22371
+ }
22372
+ return false;
22373
+ }
21835
22374
  isTaintedExpressionStep(node) {
21836
22375
  const text = getNodeText2(node, this.source);
21837
22376
  if (node.type === "method_invocation") {
@@ -21839,6 +22378,9 @@ var ConstantPropagator = class _ConstantPropagator {
21839
22378
  const objectNode = node.childForFieldName("object");
21840
22379
  if (nameNode) {
21841
22380
  const methodName = getNodeText2(nameNode, this.source);
22381
+ if (ANTI_SANITIZER_METHODS.has(methodName) && this.argIsSanitizedTaint(node)) {
22382
+ return true;
22383
+ }
21842
22384
  if (SANITIZER_METHODS.has(methodName) && !this.localNonSanitizing.has(methodName)) {
21843
22385
  return false;
21844
22386
  }