circle-ir 4.9.19 → 4.9.21

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 (251) hide show
  1. package/dist/analysis/config-loader.d.ts.map +1 -1
  2. package/dist/analysis/config-loader.js +56 -7
  3. package/dist/analysis/config-loader.js.map +1 -1
  4. package/dist/analysis/constant-propagation/evaluator.d.ts.map +1 -1
  5. package/dist/analysis/constant-propagation/evaluator.js.map +1 -1
  6. package/dist/analysis/constant-propagation/index.js.map +1 -1
  7. package/dist/analysis/constant-propagation/propagator.d.ts.map +1 -1
  8. package/dist/analysis/constant-propagation/propagator.js +3 -1
  9. package/dist/analysis/constant-propagation/propagator.js.map +1 -1
  10. package/dist/analysis/dfg-verifier.d.ts.map +1 -1
  11. package/dist/analysis/dfg-verifier.js.map +1 -1
  12. package/dist/analysis/dfg-walk.js.map +1 -1
  13. package/dist/analysis/findings.d.ts +1 -1
  14. package/dist/analysis/findings.d.ts.map +1 -1
  15. package/dist/analysis/findings.js +27 -1
  16. package/dist/analysis/findings.js.map +1 -1
  17. package/dist/analysis/interprocedural.js.map +1 -1
  18. package/dist/analysis/metrics/metric-runner.d.ts.map +1 -1
  19. package/dist/analysis/metrics/passes/cohesion-metrics-pass.d.ts.map +1 -1
  20. package/dist/analysis/metrics/passes/complexity-metrics-pass.d.ts.map +1 -1
  21. package/dist/analysis/metrics/passes/composite-metrics-pass.d.ts.map +1 -1
  22. package/dist/analysis/metrics/passes/coupling-metrics-pass.d.ts.map +1 -1
  23. package/dist/analysis/metrics/passes/data-flow-metrics-pass.d.ts.map +1 -1
  24. package/dist/analysis/metrics/passes/documentation-metrics-pass.d.ts.map +1 -1
  25. package/dist/analysis/metrics/passes/halstead-metrics-pass.d.ts.map +1 -1
  26. package/dist/analysis/metrics/passes/inheritance-metrics-pass.d.ts.map +1 -1
  27. package/dist/analysis/metrics/passes/size-metrics-pass.d.ts.map +1 -1
  28. package/dist/analysis/passes/blocking-main-thread-pass.d.ts +1 -1
  29. package/dist/analysis/passes/blocking-main-thread-pass.d.ts.map +1 -1
  30. package/dist/analysis/passes/broad-catch-pass.d.ts +1 -1
  31. package/dist/analysis/passes/broad-catch-pass.d.ts.map +1 -1
  32. package/dist/analysis/passes/cache-no-vary-pass.d.ts +1 -1
  33. package/dist/analysis/passes/cache-no-vary-pass.d.ts.map +1 -1
  34. package/dist/analysis/passes/circular-dependency-pass.d.ts.map +1 -1
  35. package/dist/analysis/passes/cleanup-verify-pass.d.ts +1 -1
  36. package/dist/analysis/passes/cleanup-verify-pass.d.ts.map +1 -1
  37. package/dist/analysis/passes/cleartext-credential-transport-pass.d.ts +1 -1
  38. package/dist/analysis/passes/cleartext-credential-transport-pass.d.ts.map +1 -1
  39. package/dist/analysis/passes/cli-main-reflection-suppress-pass.d.ts +1 -1
  40. package/dist/analysis/passes/cli-main-reflection-suppress-pass.d.ts.map +1 -1
  41. package/dist/analysis/passes/constant-propagation-pass.d.ts +1 -1
  42. package/dist/analysis/passes/constant-propagation-pass.d.ts.map +1 -1
  43. package/dist/analysis/passes/constant-propagation-pass.js.map +1 -1
  44. package/dist/analysis/passes/cross-file-pass.d.ts.map +1 -1
  45. package/dist/analysis/passes/cross-file-pass.js +1 -1
  46. package/dist/analysis/passes/cross-file-pass.js.map +1 -1
  47. package/dist/analysis/passes/csrf-protection-disabled-pass.d.ts +1 -1
  48. package/dist/analysis/passes/csrf-protection-disabled-pass.d.ts.map +1 -1
  49. package/dist/analysis/passes/dead-code-pass.d.ts +1 -1
  50. package/dist/analysis/passes/dead-code-pass.d.ts.map +1 -1
  51. package/dist/analysis/passes/deep-inheritance-pass.d.ts +1 -1
  52. package/dist/analysis/passes/deep-inheritance-pass.d.ts.map +1 -1
  53. package/dist/analysis/passes/dependency-fan-out-pass.d.ts +1 -1
  54. package/dist/analysis/passes/dependency-fan-out-pass.d.ts.map +1 -1
  55. package/dist/analysis/passes/deserialization-safety-gate-pass.d.ts +1 -1
  56. package/dist/analysis/passes/deserialization-safety-gate-pass.d.ts.map +1 -1
  57. package/dist/analysis/passes/deserialization-safety-gate-pass.js.map +1 -1
  58. package/dist/analysis/passes/double-close-pass.d.ts +1 -1
  59. package/dist/analysis/passes/double-close-pass.d.ts.map +1 -1
  60. package/dist/analysis/passes/excessive-allocation-pass.d.ts +1 -1
  61. package/dist/analysis/passes/excessive-allocation-pass.d.ts.map +1 -1
  62. package/dist/analysis/passes/feature-envy-pass.d.ts +1 -1
  63. package/dist/analysis/passes/feature-envy-pass.d.ts.map +1 -1
  64. package/dist/analysis/passes/god-class-pass.d.ts +1 -1
  65. package/dist/analysis/passes/god-class-pass.d.ts.map +1 -1
  66. package/dist/analysis/passes/infinite-loop-pass.d.ts +1 -1
  67. package/dist/analysis/passes/infinite-loop-pass.d.ts.map +1 -1
  68. package/dist/analysis/passes/info-disclosure-stacktrace-pass.d.ts +1 -1
  69. package/dist/analysis/passes/info-disclosure-stacktrace-pass.d.ts.map +1 -1
  70. package/dist/analysis/passes/insecure-cookie-pass.d.ts +1 -1
  71. package/dist/analysis/passes/insecure-cookie-pass.d.ts.map +1 -1
  72. package/dist/analysis/passes/insecure-deserialization-config-pass.d.ts +1 -1
  73. package/dist/analysis/passes/insecure-deserialization-config-pass.d.ts.map +1 -1
  74. package/dist/analysis/passes/interprocedural-pass.d.ts +1 -1
  75. package/dist/analysis/passes/interprocedural-pass.d.ts.map +1 -1
  76. package/dist/analysis/passes/jwt-verify-disabled-pass.d.ts +1 -1
  77. package/dist/analysis/passes/jwt-verify-disabled-pass.d.ts.map +1 -1
  78. package/dist/analysis/passes/language-sources-pass.d.ts +10 -10
  79. package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
  80. package/dist/analysis/passes/language-sources-pass.js +3 -8
  81. package/dist/analysis/passes/language-sources-pass.js.map +1 -1
  82. package/dist/analysis/passes/leaked-global-pass.d.ts +1 -1
  83. package/dist/analysis/passes/leaked-global-pass.d.ts.map +1 -1
  84. package/dist/analysis/passes/library-profile-sink-gate-pass.d.ts +2 -2
  85. package/dist/analysis/passes/library-profile-sink-gate-pass.d.ts.map +1 -1
  86. package/dist/analysis/passes/library-profile-source-gate-pass.d.ts +1 -1
  87. package/dist/analysis/passes/library-profile-source-gate-pass.d.ts.map +1 -1
  88. package/dist/analysis/passes/library-profile-xss-gate-pass.d.ts +1 -1
  89. package/dist/analysis/passes/library-profile-xss-gate-pass.d.ts.map +1 -1
  90. package/dist/analysis/passes/mass-assignment-pass.d.ts +1 -1
  91. package/dist/analysis/passes/mass-assignment-pass.d.ts.map +1 -1
  92. package/dist/analysis/passes/missing-await-pass.d.ts +1 -1
  93. package/dist/analysis/passes/missing-await-pass.d.ts.map +1 -1
  94. package/dist/analysis/passes/missing-guard-dom-pass.d.ts +1 -1
  95. package/dist/analysis/passes/missing-guard-dom-pass.d.ts.map +1 -1
  96. package/dist/analysis/passes/missing-override-pass.d.ts +1 -1
  97. package/dist/analysis/passes/missing-override-pass.d.ts.map +1 -1
  98. package/dist/analysis/passes/missing-public-doc-pass.d.ts +1 -1
  99. package/dist/analysis/passes/missing-public-doc-pass.d.ts.map +1 -1
  100. package/dist/analysis/passes/missing-sanitizer-gate-pass.d.ts +1 -1
  101. package/dist/analysis/passes/missing-sanitizer-gate-pass.d.ts.map +1 -1
  102. package/dist/analysis/passes/missing-stream-pass.d.ts +1 -1
  103. package/dist/analysis/passes/missing-stream-pass.d.ts.map +1 -1
  104. package/dist/analysis/passes/module-side-effect-pass.d.ts +1 -1
  105. package/dist/analysis/passes/module-side-effect-pass.d.ts.map +1 -1
  106. package/dist/analysis/passes/mybatis-annotation-sql-sink-pass.d.ts +1 -1
  107. package/dist/analysis/passes/mybatis-annotation-sql-sink-pass.d.ts.map +1 -1
  108. package/dist/analysis/passes/n-plus-one-pass.d.ts +1 -1
  109. package/dist/analysis/passes/n-plus-one-pass.d.ts.map +1 -1
  110. package/dist/analysis/passes/naming-convention-pass.d.ts +1 -1
  111. package/dist/analysis/passes/naming-convention-pass.d.ts.map +1 -1
  112. package/dist/analysis/passes/naming-convention-pass.js.map +1 -1
  113. package/dist/analysis/passes/null-deref-pass.d.ts +1 -1
  114. package/dist/analysis/passes/null-deref-pass.d.ts.map +1 -1
  115. package/dist/analysis/passes/orphan-module-pass.d.ts.map +1 -1
  116. package/dist/analysis/passes/plaintext-password-storage-pass.d.ts +1 -1
  117. package/dist/analysis/passes/plaintext-password-storage-pass.d.ts.map +1 -1
  118. package/dist/analysis/passes/prompt-injection-safety-gate-pass.d.ts +1 -1
  119. package/dist/analysis/passes/prompt-injection-safety-gate-pass.d.ts.map +1 -1
  120. package/dist/analysis/passes/python-receiver-taint-format-pass.d.ts +1 -1
  121. package/dist/analysis/passes/python-receiver-taint-format-pass.d.ts.map +1 -1
  122. package/dist/analysis/passes/react-inline-jsx-pass.d.ts +1 -1
  123. package/dist/analysis/passes/react-inline-jsx-pass.d.ts.map +1 -1
  124. package/dist/analysis/passes/redundant-loop-pass.d.ts +1 -1
  125. package/dist/analysis/passes/redundant-loop-pass.d.ts.map +1 -1
  126. package/dist/analysis/passes/resource-leak-pass.d.ts +1 -1
  127. package/dist/analysis/passes/resource-leak-pass.d.ts.map +1 -1
  128. package/dist/analysis/passes/scan-secrets-pass.d.ts +1 -1
  129. package/dist/analysis/passes/scan-secrets-pass.d.ts.map +1 -1
  130. package/dist/analysis/passes/security-headers-pass.d.ts +1 -1
  131. package/dist/analysis/passes/security-headers-pass.d.ts.map +1 -1
  132. package/dist/analysis/passes/security-headers-pass.js.map +1 -1
  133. package/dist/analysis/passes/serial-await-pass.d.ts +1 -1
  134. package/dist/analysis/passes/serial-await-pass.d.ts.map +1 -1
  135. package/dist/analysis/passes/sink-filter-pass.d.ts +1 -1
  136. package/dist/analysis/passes/sink-filter-pass.d.ts.map +1 -1
  137. package/dist/analysis/passes/sink-filter-pass.js +1 -1
  138. package/dist/analysis/passes/sink-filter-pass.js.map +1 -1
  139. package/dist/analysis/passes/sink-semantics-pass.d.ts +1 -1
  140. package/dist/analysis/passes/sink-semantics-pass.d.ts.map +1 -1
  141. package/dist/analysis/passes/source-semantics-pass.d.ts +1 -1
  142. package/dist/analysis/passes/source-semantics-pass.d.ts.map +1 -1
  143. package/dist/analysis/passes/speculative-prompt-param-source-pass.d.ts +1 -1
  144. package/dist/analysis/passes/speculative-prompt-param-source-pass.d.ts.map +1 -1
  145. package/dist/analysis/passes/speculative-prompt-param-source-pass.js.map +1 -1
  146. package/dist/analysis/passes/spring4shell-pass.d.ts +1 -1
  147. package/dist/analysis/passes/spring4shell-pass.d.ts.map +1 -1
  148. package/dist/analysis/passes/stale-doc-ref-pass.d.ts +1 -1
  149. package/dist/analysis/passes/stale-doc-ref-pass.d.ts.map +1 -1
  150. package/dist/analysis/passes/string-concat-loop-pass.d.ts +1 -1
  151. package/dist/analysis/passes/string-concat-loop-pass.d.ts.map +1 -1
  152. package/dist/analysis/passes/swallowed-exception-pass.d.ts +1 -1
  153. package/dist/analysis/passes/swallowed-exception-pass.d.ts.map +1 -1
  154. package/dist/analysis/passes/sync-io-async-pass.d.ts +1 -1
  155. package/dist/analysis/passes/sync-io-async-pass.d.ts.map +1 -1
  156. package/dist/analysis/passes/taint-matcher-pass.d.ts +1 -1
  157. package/dist/analysis/passes/taint-matcher-pass.d.ts.map +1 -1
  158. package/dist/analysis/passes/taint-propagation-pass.d.ts +1 -1
  159. package/dist/analysis/passes/taint-propagation-pass.d.ts.map +1 -1
  160. package/dist/analysis/passes/tls-verify-disabled-pass.d.ts +1 -1
  161. package/dist/analysis/passes/tls-verify-disabled-pass.d.ts.map +1 -1
  162. package/dist/analysis/passes/todo-in-prod-pass.d.ts +1 -1
  163. package/dist/analysis/passes/todo-in-prod-pass.d.ts.map +1 -1
  164. package/dist/analysis/passes/unbounded-collection-pass.d.ts +1 -1
  165. package/dist/analysis/passes/unbounded-collection-pass.d.ts.map +1 -1
  166. package/dist/analysis/passes/unchecked-return-pass.d.ts +1 -1
  167. package/dist/analysis/passes/unchecked-return-pass.d.ts.map +1 -1
  168. package/dist/analysis/passes/unhandled-exception-pass.d.ts +1 -1
  169. package/dist/analysis/passes/unhandled-exception-pass.d.ts.map +1 -1
  170. package/dist/analysis/passes/unhandled-exception-pass.js +4 -20
  171. package/dist/analysis/passes/unhandled-exception-pass.js.map +1 -1
  172. package/dist/analysis/passes/unrestricted-file-upload-pass.d.ts +1 -1
  173. package/dist/analysis/passes/unrestricted-file-upload-pass.d.ts.map +1 -1
  174. package/dist/analysis/passes/unused-interface-method-pass.d.ts +1 -1
  175. package/dist/analysis/passes/unused-interface-method-pass.d.ts.map +1 -1
  176. package/dist/analysis/passes/unused-variable-pass.d.ts +1 -1
  177. package/dist/analysis/passes/unused-variable-pass.d.ts.map +1 -1
  178. package/dist/analysis/passes/use-after-close-pass.d.ts +1 -1
  179. package/dist/analysis/passes/use-after-close-pass.d.ts.map +1 -1
  180. package/dist/analysis/passes/variable-shadowing-pass.d.ts +1 -1
  181. package/dist/analysis/passes/variable-shadowing-pass.d.ts.map +1 -1
  182. package/dist/analysis/passes/weak-crypto-pass.d.ts +1 -1
  183. package/dist/analysis/passes/weak-crypto-pass.d.ts.map +1 -1
  184. package/dist/analysis/passes/weak-hash-pass.d.ts +1 -1
  185. package/dist/analysis/passes/weak-hash-pass.d.ts.map +1 -1
  186. package/dist/analysis/passes/weak-password-encoding-pass.d.ts +1 -1
  187. package/dist/analysis/passes/weak-password-encoding-pass.d.ts.map +1 -1
  188. package/dist/analysis/passes/weak-password-hash-pass.d.ts +1 -1
  189. package/dist/analysis/passes/weak-password-hash-pass.d.ts.map +1 -1
  190. package/dist/analysis/passes/weak-random-pass.d.ts +1 -1
  191. package/dist/analysis/passes/weak-random-pass.d.ts.map +1 -1
  192. package/dist/analysis/passes/xml-entity-expansion-pass.d.ts +1 -1
  193. package/dist/analysis/passes/xml-entity-expansion-pass.d.ts.map +1 -1
  194. package/dist/analysis/path-finder.d.ts.map +1 -1
  195. package/dist/analysis/path-finder.js.map +1 -1
  196. package/dist/analysis/project-profile-transform.js.map +1 -1
  197. package/dist/analysis/require-entry-path.js.map +1 -1
  198. package/dist/analysis/sbom.js.map +1 -1
  199. package/dist/analysis/taint-matcher.js.map +1 -1
  200. package/dist/analyzer.d.ts.map +1 -1
  201. package/dist/analyzer.js +4 -0
  202. package/dist/analyzer.js.map +1 -1
  203. package/dist/browser/circle-ir.js +157 -54
  204. package/dist/browser.js.map +1 -1
  205. package/dist/core/circle-ir-core.cjs +150 -29
  206. package/dist/core/circle-ir-core.js +150 -29
  207. package/dist/core/extractors/cfg.js +2 -2
  208. package/dist/core/extractors/cfg.js.map +1 -1
  209. package/dist/core/extractors/dfg.js +1 -1
  210. package/dist/core/extractors/dfg.js.map +1 -1
  211. package/dist/core/extractors/runtime-registrations.js +2 -2
  212. package/dist/core/extractors/runtime-registrations.js.map +1 -1
  213. package/dist/core/extractors/types.js.map +1 -1
  214. package/dist/core/parser.d.ts.map +1 -1
  215. package/dist/core/parser.js +4 -0
  216. package/dist/core/parser.js.map +1 -1
  217. package/dist/graph/analysis-pass.d.ts.map +1 -1
  218. package/dist/graph/code-graph.d.ts.map +1 -1
  219. package/dist/graph/dominator-graph.d.ts.map +1 -1
  220. package/dist/graph/exception-flow-graph.d.ts.map +1 -1
  221. package/dist/graph/import-graph.d.ts.map +1 -1
  222. package/dist/graph/project-graph.d.ts.map +1 -1
  223. package/dist/graph/scope-graph.d.ts.map +1 -1
  224. package/dist/languages/plugins/base.d.ts.map +1 -1
  225. package/dist/languages/plugins/bash.d.ts +1 -1
  226. package/dist/languages/plugins/bash.d.ts.map +1 -1
  227. package/dist/languages/plugins/csharp.d.ts +1 -1
  228. package/dist/languages/plugins/csharp.d.ts.map +1 -1
  229. package/dist/languages/plugins/go.d.ts +1 -1
  230. package/dist/languages/plugins/go.d.ts.map +1 -1
  231. package/dist/languages/plugins/html.d.ts +1 -1
  232. package/dist/languages/plugins/html.d.ts.map +1 -1
  233. package/dist/languages/plugins/java.d.ts +1 -1
  234. package/dist/languages/plugins/java.d.ts.map +1 -1
  235. package/dist/languages/plugins/javascript.d.ts +1 -1
  236. package/dist/languages/plugins/javascript.d.ts.map +1 -1
  237. package/dist/languages/plugins/python.d.ts +1 -1
  238. package/dist/languages/plugins/python.d.ts.map +1 -1
  239. package/dist/languages/plugins/rust.d.ts +1 -1
  240. package/dist/languages/plugins/rust.d.ts.map +1 -1
  241. package/dist/languages/plugins/vue.d.ts +1 -1
  242. package/dist/languages/plugins/vue.d.ts.map +1 -1
  243. package/dist/resolution/cross-file.d.ts.map +1 -1
  244. package/dist/resolution/symbol-table.d.ts.map +1 -1
  245. package/dist/resolution/type-hierarchy.d.ts.map +1 -1
  246. package/dist/resolution/type-hierarchy.js.map +1 -1
  247. package/dist/types/index.d.ts +28 -0
  248. package/dist/types/index.d.ts.map +1 -1
  249. package/dist/utils/logger.d.ts.map +1 -1
  250. package/dist/wasm/web-tree-sitter.wasm +0 -0
  251. package/package.json +7 -7
@@ -187,6 +187,18 @@ function setModule(module2) {
187
187
  }
188
188
  __name(setModule, "setModule");
189
189
  var C;
190
+ function newFinalizer(handler) {
191
+ try {
192
+ return new FinalizationRegistry(handler);
193
+ } catch (e) {
194
+ console.error("Unsupported FinalizationRegistry:", e);
195
+ return;
196
+ }
197
+ }
198
+ __name(newFinalizer, "newFinalizer");
199
+ var finalizer = newFinalizer((address) => {
200
+ C._ts_lookahead_iterator_delete(address);
201
+ });
190
202
  var LookaheadIterator = class {
191
203
  static {
192
204
  __name(this, "LookaheadIterator");
@@ -197,21 +209,39 @@ var LookaheadIterator = class {
197
209
  /** @internal */
198
210
  language;
199
211
  /** @internal */
212
+ positioned = false;
213
+ /** @internal */
200
214
  constructor(internal, address, language) {
201
215
  assertInternal(internal);
202
216
  this[0] = address;
203
217
  this.language = language;
218
+ finalizer?.register(this, address, this);
204
219
  }
205
- /** Get the current symbol of the lookahead iterator. */
220
+ /**
221
+ * Get the current symbol of the lookahead iterator.
222
+ *
223
+ * Returns `null` if the iterator is not positioned on a symbol:
224
+ *
225
+ * - Before the first iteration step
226
+ * - After the iterator is exhausted
227
+ * - After a {@link reset} or {@link resetState} call
228
+ */
206
229
  get currentTypeId() {
207
- return C._ts_lookahead_iterator_current_symbol(this[0]);
230
+ return this.positioned ? C._ts_lookahead_iterator_current_symbol(this[0]) : null;
208
231
  }
209
- /** Get the current symbol name of the lookahead iterator. */
232
+ /**
233
+ * Get the current symbol name of the lookahead iterator.
234
+ *
235
+ * Returns `null` if the iterator is not positioned on a symbol.
236
+ */
210
237
  get currentType() {
211
- return this.language.types[this.currentTypeId] || "ERROR";
238
+ const id = this.currentTypeId;
239
+ if (id === null) return null;
240
+ return this.language.types[id] ?? C.UTF8ToString(C._ts_language_symbol_name(this.language[0], id));
212
241
  }
213
242
  /** Delete the lookahead iterator, freeing its resources. */
214
243
  delete() {
244
+ finalizer?.unregister(this);
215
245
  C._ts_lookahead_iterator_delete(this[0]);
216
246
  this[0] = 0;
217
247
  }
@@ -224,6 +254,7 @@ var LookaheadIterator = class {
224
254
  reset(language, stateId) {
225
255
  if (C._ts_lookahead_iterator_reset(this[0], language[0], stateId)) {
226
256
  this.language = language;
257
+ this.positioned = false;
227
258
  return true;
228
259
  }
229
260
  return false;
@@ -235,7 +266,9 @@ var LookaheadIterator = class {
235
266
  * `false` otherwise.
236
267
  */
237
268
  resetState(stateId) {
238
- return Boolean(C._ts_lookahead_iterator_reset_state(this[0], stateId));
269
+ if (!C._ts_lookahead_iterator_reset_state(this[0], stateId)) return false;
270
+ this.positioned = false;
271
+ return true;
239
272
  }
240
273
  /**
241
274
  * Returns an iterator that iterates over the symbols of the lookahead iterator.
@@ -246,10 +279,9 @@ var LookaheadIterator = class {
246
279
  [Symbol.iterator]() {
247
280
  return {
248
281
  next: /* @__PURE__ */ __name(() => {
249
- if (C._ts_lookahead_iterator_next(this[0])) {
250
- return { done: false, value: this.currentType };
251
- }
252
- return { done: true, value: "" };
282
+ this.positioned = Boolean(C._ts_lookahead_iterator_next(this[0]));
283
+ const value = this.currentType;
284
+ return value === null ? { done: true, value: "" } : { done: false, value };
253
285
  }, "next")
254
286
  };
255
287
  }
@@ -275,6 +307,9 @@ function getText(tree, startIndex, endIndex, startPosition) {
275
307
  return result ?? "";
276
308
  }
277
309
  __name(getText, "getText");
310
+ var finalizer2 = newFinalizer((address) => {
311
+ C._ts_tree_delete(address);
312
+ });
278
313
  var Tree = class _Tree {
279
314
  static {
280
315
  __name(this, "Tree");
@@ -292,6 +327,7 @@ var Tree = class _Tree {
292
327
  this[0] = address;
293
328
  this.language = language;
294
329
  this.textCallback = textCallback;
330
+ finalizer2?.register(this, address, this);
295
331
  }
296
332
  /** Create a shallow copy of the syntax tree. This is very fast. */
297
333
  copy() {
@@ -300,6 +336,7 @@ var Tree = class _Tree {
300
336
  }
301
337
  /** Delete the syntax tree, freeing its resources. */
302
338
  delete() {
339
+ finalizer2?.unregister(this);
303
340
  C._ts_tree_delete(this[0]);
304
341
  this[0] = 0;
305
342
  }
@@ -380,6 +417,9 @@ var Tree = class _Tree {
380
417
  return result;
381
418
  }
382
419
  };
420
+ var finalizer3 = newFinalizer((address) => {
421
+ C._ts_tree_cursor_delete_wasm(address);
422
+ });
383
423
  var TreeCursor = class _TreeCursor {
384
424
  static {
385
425
  __name(this, "TreeCursor");
@@ -407,6 +447,7 @@ var TreeCursor = class _TreeCursor {
407
447
  assertInternal(internal);
408
448
  this.tree = tree;
409
449
  unmarshalTreeCursor(this);
450
+ finalizer3?.register(this, this.tree[0], this);
410
451
  }
411
452
  /** Creates a deep copy of the tree cursor. This allocates new memory. */
412
453
  copy() {
@@ -417,6 +458,7 @@ var TreeCursor = class _TreeCursor {
417
458
  }
418
459
  /** Delete the tree cursor, freeing its resources. */
419
460
  delete() {
461
+ finalizer3?.unregister(this);
420
462
  marshalTreeCursor(this);
421
463
  C._ts_tree_cursor_delete_wasm(this.tree[0]);
422
464
  this[0] = this[1] = this[2] = 0;
@@ -1511,8 +1553,9 @@ var Language = class _Language {
1511
1553
  * This returns `null` if state is invalid for this language.
1512
1554
  *
1513
1555
  * Iterating {@link LookaheadIterator} will yield valid symbols in the given
1514
- * parse state. Newly created lookahead iterators will return the `ERROR`
1515
- * symbol from {@link LookaheadIterator#currentType}.
1556
+ * parse state. A newly created iterator is not positioned on a symbol, so
1557
+ * {@link LookaheadIterator#currentType} returns `null` until the first
1558
+ * iteration step.
1516
1559
  *
1517
1560
  * Lookahead iterators can be useful for generating suggestions and improving
1518
1561
  * syntax error diagnostics. To get symbols valid in an `ERROR` node, use the
@@ -1527,7 +1570,8 @@ var Language = class _Language {
1527
1570
  }
1528
1571
  /**
1529
1572
  * Load a language from a WebAssembly module.
1530
- * The module can be provided as a path to a file or as a buffer.
1573
+ * The module can be provided as a path to a file, a `URL` to a file, or as a
1574
+ * buffer.
1531
1575
  */
1532
1576
  static async load(input) {
1533
1577
  let binary2;
@@ -1554,16 +1598,27 @@ ${body2}`);
1554
1598
  }
1555
1599
  }
1556
1600
  const mod = await C.loadWebAssemblyModule(binary2, { loadAsync: true });
1601
+ return _Language.loadFromWasmExports(mod, { sync: false });
1602
+ }
1603
+ static loadFromWasmExports(mod, { sync }) {
1557
1604
  const symbolNames = Object.keys(mod);
1558
1605
  const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
1559
1606
  if (!functionName) {
1560
1607
  console.log(`Couldn't find language function in Wasm file. Symbols:
1561
1608
  ${JSON.stringify(symbolNames, null, 2)}`);
1562
- throw new Error("Language.load failed: no language function found in Wasm file");
1609
+ throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
1563
1610
  }
1564
1611
  const languageAddress = mod[functionName]();
1565
1612
  return new _Language(INTERNAL, languageAddress);
1566
1613
  }
1614
+ /**
1615
+ * Load a language synchronously from a pre-compiled WebAssembly module.
1616
+ * Use this when the host environment provides a `WebAssembly.Module` directly.
1617
+ */
1618
+ static loadSync(wasmModule) {
1619
+ const mod = C.loadWebAssemblyModule(wasmModule, { loadAsync: false });
1620
+ return _Language.loadFromWasmExports(mod, { sync: true });
1621
+ }
1567
1622
  };
1568
1623
  async function Module2(moduleArg = {}) {
1569
1624
  var moduleRtn;
@@ -2086,7 +2141,7 @@ async function Module2(moduleArg = {}) {
2086
2141
  newDSO("__main__", 0, wasmImports);
2087
2142
  }
2088
2143
  };
2089
- var ___heap_base = 78240;
2144
+ var ___heap_base = 82240;
2090
2145
  var alignMemory = /* @__PURE__ */ __name((size, alignment) => Math.ceil(size / alignment) * alignment, "alignMemory");
2091
2146
  var getMemory = /* @__PURE__ */ __name((size) => {
2092
2147
  if (runtimeInitialized) {
@@ -2651,12 +2706,12 @@ async function Module2(moduleArg = {}) {
2651
2706
  "value": "i32",
2652
2707
  "mutable": false
2653
2708
  }, 1024);
2654
- var ___stack_high = 78240;
2655
- var ___stack_low = 12704;
2709
+ var ___stack_high = 82240;
2710
+ var ___stack_low = 16704;
2656
2711
  var ___stack_pointer = new WebAssembly.Global({
2657
2712
  "value": "i32",
2658
2713
  "mutable": true
2659
- }, 78240);
2714
+ }, 82240);
2660
2715
  var ___table_base = new WebAssembly.Global({
2661
2716
  "value": "i32",
2662
2717
  "mutable": false
@@ -2917,7 +2972,7 @@ async function Module2(moduleArg = {}) {
2917
2972
  Module["loadWebAssemblyModule"] = loadWebAssemblyModule;
2918
2973
  Module["LE_HEAP_STORE_I64"] = LE_HEAP_STORE_I64;
2919
2974
  var ASM_CONSTS = {};
2920
- var _malloc, _calloc, _realloc, _free, _ts_range_edit, _memcmp, _ts_language_symbol_count, _ts_language_state_count, _ts_language_abi_version, _ts_language_name, _ts_language_field_count, _ts_language_next_state, _ts_language_symbol_name, _ts_language_symbol_for_name, _strncmp, _ts_language_symbol_type, _ts_language_field_name_for_id, _ts_lookahead_iterator_new, _ts_lookahead_iterator_delete, _ts_lookahead_iterator_reset_state, _ts_lookahead_iterator_reset, _ts_lookahead_iterator_next, _ts_lookahead_iterator_current_symbol, _ts_point_edit, _ts_parser_delete, _ts_parser_reset, _ts_parser_set_language, _ts_parser_set_included_ranges, _ts_query_new, _ts_query_delete, _iswspace, _iswalnum, _ts_query_pattern_count, _ts_query_capture_count, _ts_query_string_count, _ts_query_capture_name_for_id, _ts_query_capture_quantifier_for_id, _ts_query_string_value_for_id, _ts_query_predicates_for_pattern, _ts_query_start_byte_for_pattern, _ts_query_end_byte_for_pattern, _ts_query_is_pattern_rooted, _ts_query_is_pattern_non_local, _ts_query_is_pattern_guaranteed_at_step, _ts_query_disable_capture, _ts_query_disable_pattern, _ts_tree_copy, _ts_tree_delete, _ts_init, _ts_parser_new_wasm, _ts_parser_enable_logger_wasm, _ts_parser_parse_wasm, _ts_parser_included_ranges_wasm, _ts_language_type_is_named_wasm, _ts_language_type_is_visible_wasm, _ts_language_metadata_wasm, _ts_language_supertypes_wasm, _ts_language_subtypes_wasm, _ts_tree_root_node_wasm, _ts_tree_root_node_with_offset_wasm, _ts_tree_edit_wasm, _ts_tree_included_ranges_wasm, _ts_tree_get_changed_ranges_wasm, _ts_tree_cursor_new_wasm, _ts_tree_cursor_copy_wasm, _ts_tree_cursor_delete_wasm, _ts_tree_cursor_reset_wasm, _ts_tree_cursor_reset_to_wasm, _ts_tree_cursor_goto_first_child_wasm, _ts_tree_cursor_goto_last_child_wasm, _ts_tree_cursor_goto_first_child_for_index_wasm, _ts_tree_cursor_goto_first_child_for_position_wasm, _ts_tree_cursor_goto_next_sibling_wasm, _ts_tree_cursor_goto_previous_sibling_wasm, _ts_tree_cursor_goto_descendant_wasm, _ts_tree_cursor_goto_parent_wasm, _ts_tree_cursor_current_node_type_id_wasm, _ts_tree_cursor_current_node_state_id_wasm, _ts_tree_cursor_current_node_is_named_wasm, _ts_tree_cursor_current_node_is_missing_wasm, _ts_tree_cursor_current_node_id_wasm, _ts_tree_cursor_start_position_wasm, _ts_tree_cursor_end_position_wasm, _ts_tree_cursor_start_index_wasm, _ts_tree_cursor_end_index_wasm, _ts_tree_cursor_current_field_id_wasm, _ts_tree_cursor_current_depth_wasm, _ts_tree_cursor_current_descendant_index_wasm, _ts_tree_cursor_current_node_wasm, _ts_node_symbol_wasm, _ts_node_field_name_for_child_wasm, _ts_node_field_name_for_named_child_wasm, _ts_node_children_by_field_id_wasm, _ts_node_first_child_for_byte_wasm, _ts_node_first_named_child_for_byte_wasm, _ts_node_grammar_symbol_wasm, _ts_node_child_count_wasm, _ts_node_named_child_count_wasm, _ts_node_child_wasm, _ts_node_named_child_wasm, _ts_node_child_by_field_id_wasm, _ts_node_next_sibling_wasm, _ts_node_prev_sibling_wasm, _ts_node_next_named_sibling_wasm, _ts_node_prev_named_sibling_wasm, _ts_node_descendant_count_wasm, _ts_node_parent_wasm, _ts_node_child_with_descendant_wasm, _ts_node_descendant_for_index_wasm, _ts_node_named_descendant_for_index_wasm, _ts_node_descendant_for_position_wasm, _ts_node_named_descendant_for_position_wasm, _ts_node_start_point_wasm, _ts_node_end_point_wasm, _ts_node_start_index_wasm, _ts_node_end_index_wasm, _ts_node_to_string_wasm, _ts_node_children_wasm, _ts_node_named_children_wasm, _ts_node_descendants_of_type_wasm, _ts_node_is_named_wasm, _ts_node_has_changes_wasm, _ts_node_has_error_wasm, _ts_node_is_error_wasm, _ts_node_is_missing_wasm, _ts_node_is_extra_wasm, _ts_node_parse_state_wasm, _ts_node_next_parse_state_wasm, _ts_query_matches_wasm, _ts_query_captures_wasm, _memset, _memcpy, _memmove, _iswalpha, _iswblank, _iswdigit, _iswlower, _iswupper, _iswxdigit, _memchr, _strlen, _strcmp, _strncat, _strncpy, _towlower, _towupper, _setThrew, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, ___wasm_apply_data_relocs;
2975
+ var _malloc, _calloc, _realloc, _free, _ts_range_edit, _memcmp, _ts_language_symbol_count, _ts_language_state_count, _ts_language_abi_version, _ts_language_name, _ts_language_field_count, _ts_language_next_state, _ts_language_symbol_name, _ts_language_symbol_for_name, _strncmp, _ts_language_symbol_type, _ts_language_field_name_for_id, _ts_lookahead_iterator_new, _ts_lookahead_iterator_delete, _ts_lookahead_iterator_reset_state, _ts_lookahead_iterator_reset, _ts_lookahead_iterator_next, _ts_lookahead_iterator_current_symbol, _ts_point_edit, _ts_parser_delete, _ts_parser_reset, _ts_parser_set_language, _ts_parser_set_included_ranges, _ts_query_new, _ts_query_delete, _iswspace, _iswalnum, _ts_query_copy, _ts_query_pattern_count, _ts_query_capture_count, _ts_query_string_count, _ts_query_capture_name_for_id, _ts_query_capture_quantifier_for_id, _ts_query_string_value_for_id, _ts_query_predicates_for_pattern, _ts_query_start_byte_for_pattern, _ts_query_end_byte_for_pattern, _ts_query_is_pattern_rooted, _ts_query_is_pattern_non_local, _ts_query_is_pattern_guaranteed_at_step, _ts_query_disable_capture, _ts_query_disable_pattern, _ts_tree_copy, _ts_tree_delete, _ts_init, _ts_parser_new_wasm, _ts_parser_enable_logger_wasm, _ts_parser_parse_wasm, _ts_parser_included_ranges_wasm, _ts_language_type_is_named_wasm, _ts_language_type_is_visible_wasm, _ts_language_metadata_wasm, _ts_language_supertypes_wasm, _ts_language_subtypes_wasm, _ts_tree_root_node_wasm, _ts_tree_root_node_with_offset_wasm, _ts_tree_edit_wasm, _ts_tree_included_ranges_wasm, _ts_tree_get_changed_ranges_wasm, _ts_tree_cursor_new_wasm, _ts_tree_cursor_copy_wasm, _ts_tree_cursor_delete_wasm, _ts_tree_cursor_reset_wasm, _ts_tree_cursor_reset_to_wasm, _ts_tree_cursor_goto_first_child_wasm, _ts_tree_cursor_goto_last_child_wasm, _ts_tree_cursor_goto_first_child_for_index_wasm, _ts_tree_cursor_goto_first_child_for_position_wasm, _ts_tree_cursor_goto_next_sibling_wasm, _ts_tree_cursor_goto_previous_sibling_wasm, _ts_tree_cursor_goto_descendant_wasm, _ts_tree_cursor_goto_parent_wasm, _ts_tree_cursor_current_node_type_id_wasm, _ts_tree_cursor_current_node_state_id_wasm, _ts_tree_cursor_current_node_is_named_wasm, _ts_tree_cursor_current_node_is_missing_wasm, _ts_tree_cursor_current_node_id_wasm, _ts_tree_cursor_start_position_wasm, _ts_tree_cursor_end_position_wasm, _ts_tree_cursor_start_index_wasm, _ts_tree_cursor_end_index_wasm, _ts_tree_cursor_current_field_id_wasm, _ts_tree_cursor_current_depth_wasm, _ts_tree_cursor_current_descendant_index_wasm, _ts_tree_cursor_current_node_wasm, _ts_node_symbol_wasm, _ts_node_field_name_for_child_wasm, _ts_node_field_name_for_named_child_wasm, _ts_node_children_by_field_id_wasm, _ts_node_first_child_for_byte_wasm, _ts_node_first_named_child_for_byte_wasm, _ts_node_grammar_symbol_wasm, _ts_node_child_count_wasm, _ts_node_named_child_count_wasm, _ts_node_child_wasm, _ts_node_named_child_wasm, _ts_node_child_by_field_id_wasm, _ts_node_next_sibling_wasm, _ts_node_prev_sibling_wasm, _ts_node_next_named_sibling_wasm, _ts_node_prev_named_sibling_wasm, _ts_node_descendant_count_wasm, _ts_node_parent_wasm, _ts_node_child_with_descendant_wasm, _ts_node_descendant_for_index_wasm, _ts_node_named_descendant_for_index_wasm, _ts_node_descendant_for_position_wasm, _ts_node_named_descendant_for_position_wasm, _ts_node_start_point_wasm, _ts_node_end_point_wasm, _ts_node_start_index_wasm, _ts_node_end_index_wasm, _ts_node_to_string_wasm, _ts_node_children_wasm, _ts_node_named_children_wasm, _ts_node_descendants_of_type_wasm, _ts_node_is_named_wasm, _ts_node_has_changes_wasm, _ts_node_has_error_wasm, _ts_node_is_error_wasm, _ts_node_is_missing_wasm, _ts_node_is_extra_wasm, _ts_node_parse_state_wasm, _ts_node_next_parse_state_wasm, _ts_query_matches_wasm, _ts_query_captures_wasm, _memset, _memcpy, _memmove, _iswalpha, _iswblank, _iswdigit, _iswlower, _iswpunct, _iswupper, _iswxdigit, _memchr, _strlen, _strcmp, _strncat, _strncpy, _towlower, _towupper, _setThrew, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, ___wasm_apply_data_relocs;
2921
2976
  function assignWasmExports(wasmExports2) {
2922
2977
  Module["_malloc"] = _malloc = wasmExports2["malloc"];
2923
2978
  Module["_calloc"] = _calloc = wasmExports2["calloc"];
@@ -2951,6 +3006,7 @@ async function Module2(moduleArg = {}) {
2951
3006
  Module["_ts_query_delete"] = _ts_query_delete = wasmExports2["ts_query_delete"];
2952
3007
  Module["_iswspace"] = _iswspace = wasmExports2["iswspace"];
2953
3008
  Module["_iswalnum"] = _iswalnum = wasmExports2["iswalnum"];
3009
+ Module["_ts_query_copy"] = _ts_query_copy = wasmExports2["ts_query_copy"];
2954
3010
  Module["_ts_query_pattern_count"] = _ts_query_pattern_count = wasmExports2["ts_query_pattern_count"];
2955
3011
  Module["_ts_query_capture_count"] = _ts_query_capture_count = wasmExports2["ts_query_capture_count"];
2956
3012
  Module["_ts_query_string_count"] = _ts_query_string_count = wasmExports2["ts_query_string_count"];
@@ -3056,6 +3112,7 @@ async function Module2(moduleArg = {}) {
3056
3112
  Module["_iswblank"] = _iswblank = wasmExports2["iswblank"];
3057
3113
  Module["_iswdigit"] = _iswdigit = wasmExports2["iswdigit"];
3058
3114
  Module["_iswlower"] = _iswlower = wasmExports2["iswlower"];
3115
+ Module["_iswpunct"] = _iswpunct = wasmExports2["iswpunct"];
3059
3116
  Module["_iswupper"] = _iswupper = wasmExports2["iswupper"];
3060
3117
  Module["_iswxdigit"] = _iswxdigit = wasmExports2["iswxdigit"];
3061
3118
  Module["_memchr"] = _memchr = wasmExports2["memchr"];
@@ -3193,6 +3250,10 @@ __name(checkModule, "checkModule");
3193
3250
  var TRANSFER_BUFFER;
3194
3251
  var LANGUAGE_VERSION;
3195
3252
  var MIN_COMPATIBLE_VERSION;
3253
+ var finalizer4 = newFinalizer((addresses) => {
3254
+ C._ts_parser_delete(addresses[0]);
3255
+ C._free(addresses[1]);
3256
+ });
3196
3257
  var Parser = class {
3197
3258
  static {
3198
3259
  __name(this, "Parser");
@@ -3224,6 +3285,7 @@ var Parser = class {
3224
3285
  */
3225
3286
  constructor() {
3226
3287
  this.initialize();
3288
+ finalizer4?.register(this, [this[0], this[1]], this);
3227
3289
  }
3228
3290
  /** @internal */
3229
3291
  initialize() {
@@ -3236,6 +3298,7 @@ var Parser = class {
3236
3298
  }
3237
3299
  /** Delete the parser, freeing its resources. */
3238
3300
  delete() {
3301
+ finalizer4?.unregister(this);
3239
3302
  C._ts_parser_delete(this[0]);
3240
3303
  C._free(this[1]);
3241
3304
  this[0] = 0;
@@ -3411,6 +3474,10 @@ var QueryError = class _QueryError extends Error {
3411
3474
  this.length = length;
3412
3475
  this.name = "QueryError";
3413
3476
  }
3477
+ kind;
3478
+ info;
3479
+ index;
3480
+ length;
3414
3481
  static {
3415
3482
  __name(this, "QueryError");
3416
3483
  }
@@ -3606,6 +3673,9 @@ function parsePattern(index, stepType, stepValueId, captureNames, stringValues,
3606
3673
  }
3607
3674
  }
3608
3675
  __name(parsePattern, "parsePattern");
3676
+ var finalizer5 = newFinalizer((address) => {
3677
+ C._ts_query_delete(address);
3678
+ });
3609
3679
  var Query = class {
3610
3680
  static {
3611
3681
  __name(this, "Query");
@@ -3760,9 +3830,11 @@ var Query = class {
3760
3830
  this.assertedProperties = assertedProperties;
3761
3831
  this.refutedProperties = refutedProperties;
3762
3832
  this.exceededMatchLimit = false;
3833
+ finalizer5?.register(this, address, this);
3763
3834
  }
3764
3835
  /** Delete the query, freeing its resources. */
3765
3836
  delete() {
3837
+ finalizer5?.unregister(this);
3766
3838
  C._ts_query_delete(this[0]);
3767
3839
  this[0] = 0;
3768
3840
  }
@@ -9199,7 +9271,7 @@ function buildBashCFG(tree, startId, cache) {
9199
9271
  allEdges.push({ from: entryBlock.id, to: firstBlockId, type: "sequential" });
9200
9272
  }
9201
9273
  const exitBlock = {
9202
- id: blockIdCounter++,
9274
+ id: blockIdCounter,
9203
9275
  type: "exit",
9204
9276
  start_line: topLevelStatements[topLevelStatements.length - 1].endPosition.row + 1,
9205
9277
  end_line: topLevelStatements[topLevelStatements.length - 1].endPosition.row + 1
@@ -9317,7 +9389,7 @@ function buildGoCFG(tree, blockIdCounter, cache) {
9317
9389
  );
9318
9390
  if (hasTopLevelDecls) {
9319
9391
  const block = {
9320
- id: blockIdCounter++,
9392
+ id: blockIdCounter,
9321
9393
  type: "normal",
9322
9394
  start_line: 1,
9323
9395
  end_line: tree.rootNode.endPosition.row + 1
@@ -10336,7 +10408,7 @@ function buildRustDFG(tree, cache) {
10336
10408
  const defs = [];
10337
10409
  const uses = [];
10338
10410
  let defIdCounter = 1;
10339
- let useIdCounter = 1;
10411
+ const useIdCounter = 1;
10340
10412
  const scopeStack = [/* @__PURE__ */ new Map()];
10341
10413
  const functions = findNodes(tree.rootNode, "function_item");
10342
10414
  for (const func2 of functions) {
@@ -11071,12 +11143,56 @@ var DEFAULT_SOURCES = [
11071
11143
  { method: "getIn", class: "Exchange", type: "http_body", severity: "high", return_tainted: true },
11072
11144
  { method: "getHeader", class: "Message", type: "http_header", severity: "high", return_tainted: true },
11073
11145
  // File name sources (common in path traversal vulnerabilities)
11074
- { method: "getFileName", type: "file_input", severity: "high", return_tainted: true },
11075
- { method: "getName", class: "File", type: "file_input", severity: "high", return_tainted: true },
11076
- { method: "getPath", class: "File", type: "file_input", severity: "high", return_tainted: true },
11077
- { method: "getAbsolutePath", class: "File", type: "file_input", severity: "high", return_tainted: true },
11078
- { method: "toString", class: "Path", type: "file_input", severity: "medium", return_tainted: true },
11079
- { method: "getFileName", class: "Path", type: "file_input", severity: "high", return_tainted: true },
11146
+ //
11147
+ // cognium-dev#387 — the CLASSLESS `getFileName` was removed with the path
11148
+ // projections below. It had no class and no `languages` scope, so it matched
11149
+ // every `.getFileName()` anywhere, and it kept `Paths.get("/etc/app.conf")
11150
+ // .getFileName()` reporting path_traversal after the class-scoped
11151
+ // `Path.getFileName` was dropped — i.e. it silently defeated that removal,
11152
+ // the same way the classless `getPath` defeated the first revision of this
11153
+ // change. Measured redundant for the sources that matter: with it removed,
11154
+ // `Part.getFileName`, `BodyPart`/`MimeBodyPart.getFileName` and
11155
+ // `MultipartFile.getOriginalFilename` all still bind their sources from
11156
+ // their own class-scoped entries below.
11157
+ // cognium-dev#387 — REMOVED as taint sources: `File.getName`,
11158
+ // `File.getPath`, `File.getAbsolutePath`, `Path.toString`,
11159
+ // `Path.getFileName`, and the classless `getPath` further down this file.
11160
+ //
11161
+ // All of these are pure path PROJECTIONS: they hand back some part of the
11162
+ // path the object already holds. They cannot introduce taint that is not
11163
+ // already present — if the File/Path was built from untrusted input,
11164
+ // propagation carries it — but as blanket sources they turned every
11165
+ // program-constructed path into a high-severity source, and the enclosing
11166
+ // call is usually itself a sink, so source and sink land on the same line.
11167
+ // Each of these was a measured false positive with NO untrusted input
11168
+ // anywhere in the file:
11169
+ //
11170
+ // File f = new File("/etc/app.conf");
11171
+ // new FileInputStream(f.getAbsolutePath()); // path_traversal
11172
+ // new FileInputStream(f.getPath()); // path_traversal
11173
+ // new FileInputStream("/d/" + f.getName()); // path_traversal
11174
+ // Paths.get("/etc/app.conf").getFileName(); // path_traversal
11175
+ //
11176
+ // and conversely, with a genuinely tainted path the finding does NOT depend
11177
+ // on the projection being a source: it comes from the http source and
11178
+ // survives. Verified across six shapes — same-method, inline with no
11179
+ // intermediate variable, `getPath`, `Paths.get(p).toString()`, a File passed
11180
+ // cross-method as a parameter, and a field-held File read in another method.
11181
+ //
11182
+ // The genuinely untrusted name sources are separately class-scoped and
11183
+ // unaffected: `ZipEntry`/`TarArchiveEntry.getName` (Zip/Tar Slip),
11184
+ // `MultipartFile.getOriginalFilename`/`getName`, `Part`, `BodyPart`.
11185
+ // Measured: those still bind their sources with these removed.
11186
+ //
11187
+ // NO `listFiles` COVERAGE IS LOST — an earlier revision of this change
11188
+ // claimed there was. Measured directly, before vs after, for a File taken
11189
+ // from `dir.listFiles()`: `getName` 0 flows -> 0 flows, `getAbsolutePath`
11190
+ // 0 -> 0, `getPath` 1 -> 1. The first two never fired in that shape at all,
11191
+ // because class resolution does not resolve a for-each variable to `File`.
11192
+ // Modelling `listFiles` / `Files.list` / `Files.walk` as sources is still
11193
+ // worth doing — the directory listing IS external data — but it is additive,
11194
+ // needs its own FP measurement, and is not a regression from this change.
11195
+ // Tracked on #387.
11080
11196
  // Multipart file uploads
11081
11197
  { method: "getOriginalFilename", class: "MultipartFile", type: "file_input", severity: "high", return_tainted: true },
11082
11198
  { method: "getName", class: "MultipartFile", type: "file_input", severity: "high", return_tainted: true },
@@ -11168,7 +11284,12 @@ var DEFAULT_SOURCES = [
11168
11284
  // Jenkins/CI pipeline sources
11169
11285
  { method: "getScriptPath", type: "io_input", severity: "critical", return_tainted: true },
11170
11286
  { method: "getFilePathSuffix", type: "io_input", severity: "high", return_tainted: true },
11171
- { method: "getPath", type: "file_input", severity: "high", return_tainted: true },
11287
+ // cognium-dev#387 — the classless `getPath` was REMOVED here too. The first
11288
+ // revision of this change dropped only the class-scoped `File.getPath` and
11289
+ // left this one, so `f.getPath()` kept emitting a `file_input` source and the
11290
+ // self-flow false positive survived — the change did not do what it claimed.
11291
+ // This entry is strictly broader than the one it shadowed: no class and no
11292
+ // `languages` scope, so it matched every `.getPath()` in every language.
11172
11293
  { method: "contentAsString", type: "file_input", severity: "critical", return_tainted: true },
11173
11294
  { method: "readAsString", type: "file_input", severity: "critical", return_tainted: true },
11174
11295
  { method: "content", type: "file_input", severity: "high", return_tainted: true },
@@ -18937,7 +19058,7 @@ var ConstantPropagator = class _ConstantPropagator {
18937
19058
  }
18938
19059
  }
18939
19060
  const startIdx = matchingIdx >= 0 ? matchingIdx : defaultIdx;
18940
- for (let i2 = 0; i2 < startIdx && startIdx >= 0; i2++) {
19061
+ for (let i2 = 0; i2 < startIdx; i2++) {
18941
19062
  this.markUnreachable(caseGroups[i2]);
18942
19063
  }
18943
19064
  if (startIdx >= 0) {