@sikkuumiii/defuse 0.0.0-stage → 0.5.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 (236) hide show
  1. package/LICENSE +235 -0
  2. package/README.md +561 -2
  3. package/dist/src/cli.d.ts +20 -0
  4. package/dist/src/cli.js +619 -0
  5. package/dist/src/cli.js.map +1 -0
  6. package/dist/src/core/analyze.d.ts +178 -0
  7. package/dist/src/core/analyze.js +834 -0
  8. package/dist/src/core/analyze.js.map +1 -0
  9. package/dist/src/core/coverage.d.ts +87 -0
  10. package/dist/src/core/coverage.js +181 -0
  11. package/dist/src/core/coverage.js.map +1 -0
  12. package/dist/src/core/finding.d.ts +196 -0
  13. package/dist/src/core/finding.js +178 -0
  14. package/dist/src/core/finding.js.map +1 -0
  15. package/dist/src/core/licence.d.ts +50 -0
  16. package/dist/src/core/licence.js +56 -0
  17. package/dist/src/core/licence.js.map +1 -0
  18. package/dist/src/core/paths.d.ts +21 -0
  19. package/dist/src/core/paths.js +58 -0
  20. package/dist/src/core/paths.js.map +1 -0
  21. package/dist/src/core/score.d.ts +137 -0
  22. package/dist/src/core/score.js +232 -0
  23. package/dist/src/core/score.js.map +1 -0
  24. package/dist/src/dast/targets.d.ts +30 -0
  25. package/dist/src/dast/targets.js +79 -0
  26. package/dist/src/dast/targets.js.map +1 -0
  27. package/dist/src/dast/zap.d.ts +42 -0
  28. package/dist/src/dast/zap.js +184 -0
  29. package/dist/src/dast/zap.js.map +1 -0
  30. package/dist/src/engine/scan.d.ts +80 -0
  31. package/dist/src/engine/scan.js +129 -0
  32. package/dist/src/engine/scan.js.map +1 -0
  33. package/dist/src/engine/shapes.d.ts +47 -0
  34. package/dist/src/engine/shapes.js +328 -0
  35. package/dist/src/engine/shapes.js.map +1 -0
  36. package/dist/src/engine/walk.d.ts +60 -0
  37. package/dist/src/engine/walk.js +156 -0
  38. package/dist/src/engine/walk.js.map +1 -0
  39. package/dist/src/parse/astDump.d.ts +31 -0
  40. package/dist/src/parse/astDump.js +66 -0
  41. package/dist/src/parse/astDump.js.map +1 -0
  42. package/dist/src/parse/languages.d.ts +70 -0
  43. package/dist/src/parse/languages.js +174 -0
  44. package/dist/src/parse/languages.js.map +1 -0
  45. package/dist/src/parse/location.d.ts +17 -0
  46. package/dist/src/parse/location.js +38 -0
  47. package/dist/src/parse/location.js.map +1 -0
  48. package/dist/src/parse/node-grammars.d.ts +12 -0
  49. package/dist/src/parse/node-grammars.js +35 -0
  50. package/dist/src/parse/node-grammars.js.map +1 -0
  51. package/dist/src/parse/parser.d.ts +126 -0
  52. package/dist/src/parse/parser.js +202 -0
  53. package/dist/src/parse/parser.js.map +1 -0
  54. package/dist/src/parse/tree-store.d.ts +139 -0
  55. package/dist/src/parse/tree-store.js +236 -0
  56. package/dist/src/parse/tree-store.js.map +1 -0
  57. package/dist/src/platform/dependency-rule.d.ts +27 -0
  58. package/dist/src/platform/dependency-rule.js +21 -0
  59. package/dist/src/platform/dependency-rule.js.map +1 -0
  60. package/dist/src/platform/deps.d.ts +86 -0
  61. package/dist/src/platform/deps.js +304 -0
  62. package/dist/src/platform/deps.js.map +1 -0
  63. package/dist/src/platform/php-facts.d.ts +49 -0
  64. package/dist/src/platform/php-facts.js +67 -0
  65. package/dist/src/platform/php-facts.js.map +1 -0
  66. package/dist/src/platform/runtime-version.d.ts +78 -0
  67. package/dist/src/platform/runtime-version.js +573 -0
  68. package/dist/src/platform/runtime-version.js.map +1 -0
  69. package/dist/src/report/colors.d.ts +50 -0
  70. package/dist/src/report/colors.js +97 -0
  71. package/dist/src/report/colors.js.map +1 -0
  72. package/dist/src/report/coverage-table.d.ts +90 -0
  73. package/dist/src/report/coverage-table.js +291 -0
  74. package/dist/src/report/coverage-table.js.map +1 -0
  75. package/dist/src/report/html-report.d.ts +66 -0
  76. package/dist/src/report/html-report.js +489 -0
  77. package/dist/src/report/html-report.js.map +1 -0
  78. package/dist/src/report/human.d.ts +44 -0
  79. package/dist/src/report/human.js +575 -0
  80. package/dist/src/report/human.js.map +1 -0
  81. package/dist/src/report/json.d.ts +24 -0
  82. package/dist/src/report/json.js +178 -0
  83. package/dist/src/report/json.js.map +1 -0
  84. package/dist/src/report/mark.d.ts +17 -0
  85. package/dist/src/report/mark.js +39 -0
  86. package/dist/src/report/mark.js.map +1 -0
  87. package/dist/src/report/pricing.d.ts +33 -0
  88. package/dist/src/report/pricing.js +343 -0
  89. package/dist/src/report/pricing.js.map +1 -0
  90. package/dist/src/report/sarif.d.ts +39 -0
  91. package/dist/src/report/sarif.js +219 -0
  92. package/dist/src/report/sarif.js.map +1 -0
  93. package/dist/src/report/site.d.ts +87 -0
  94. package/dist/src/report/site.js +742 -0
  95. package/dist/src/report/site.js.map +1 -0
  96. package/dist/src/rules/code-injection.d.ts +47 -0
  97. package/dist/src/rules/code-injection.js +326 -0
  98. package/dist/src/rules/code-injection.js.map +1 -0
  99. package/dist/src/rules/command-injection.d.ts +30 -0
  100. package/dist/src/rules/command-injection.js +286 -0
  101. package/dist/src/rules/command-injection.js.map +1 -0
  102. package/dist/src/rules/contract.d.ts +198 -0
  103. package/dist/src/rules/contract.js +39 -0
  104. package/dist/src/rules/contract.js.map +1 -0
  105. package/dist/src/rules/format-string.d.ts +46 -0
  106. package/dist/src/rules/format-string.js +146 -0
  107. package/dist/src/rules/format-string.js.map +1 -0
  108. package/dist/src/rules/hardcoded-secret.d.ts +38 -0
  109. package/dist/src/rules/hardcoded-secret.js +440 -0
  110. package/dist/src/rules/hardcoded-secret.js.map +1 -0
  111. package/dist/src/rules/lib/guards.d.ts +168 -0
  112. package/dist/src/rules/lib/guards.js +1179 -0
  113. package/dist/src/rules/lib/guards.js.map +1 -0
  114. package/dist/src/rules/lib/html-safety.d.ts +75 -0
  115. package/dist/src/rules/lib/html-safety.js +755 -0
  116. package/dist/src/rules/lib/html-safety.js.map +1 -0
  117. package/dist/src/rules/lib/local-build.d.ts +59 -0
  118. package/dist/src/rules/lib/local-build.js +320 -0
  119. package/dist/src/rules/lib/local-build.js.map +1 -0
  120. package/dist/src/rules/lib/strings.d.ts +208 -0
  121. package/dist/src/rules/lib/strings.js +1970 -0
  122. package/dist/src/rules/lib/strings.js.map +1 -0
  123. package/dist/src/rules/path-traversal.d.ts +33 -0
  124. package/dist/src/rules/path-traversal.js +96 -0
  125. package/dist/src/rules/path-traversal.js.map +1 -0
  126. package/dist/src/rules/registry.d.ts +19 -0
  127. package/dist/src/rules/registry.js +77 -0
  128. package/dist/src/rules/registry.js.map +1 -0
  129. package/dist/src/rules/sql-injection.d.ts +36 -0
  130. package/dist/src/rules/sql-injection.js +299 -0
  131. package/dist/src/rules/sql-injection.js.map +1 -0
  132. package/dist/src/rules/ssrf.d.ts +39 -0
  133. package/dist/src/rules/ssrf.js +111 -0
  134. package/dist/src/rules/ssrf.js.map +1 -0
  135. package/dist/src/rules/unbounded-copy.d.ts +37 -0
  136. package/dist/src/rules/unbounded-copy.js +147 -0
  137. package/dist/src/rules/unbounded-copy.js.map +1 -0
  138. package/dist/src/rules/unsafe-deserialization.d.ts +43 -0
  139. package/dist/src/rules/unsafe-deserialization.js +276 -0
  140. package/dist/src/rules/unsafe-deserialization.js.map +1 -0
  141. package/dist/src/rules/weak-hash.d.ts +37 -0
  142. package/dist/src/rules/weak-hash.js +197 -0
  143. package/dist/src/rules/weak-hash.js.map +1 -0
  144. package/dist/src/rules/xss.d.ts +38 -0
  145. package/dist/src/rules/xss.js +527 -0
  146. package/dist/src/rules/xss.js.map +1 -0
  147. package/dist/src/taint/content-type.d.ts +19 -0
  148. package/dist/src/taint/content-type.js +20 -0
  149. package/dist/src/taint/content-type.js.map +1 -0
  150. package/dist/src/taint/dictionaries.d.ts +23 -0
  151. package/dist/src/taint/dictionaries.js +1778 -0
  152. package/dist/src/taint/dictionaries.js.map +1 -0
  153. package/dist/src/taint/fold.d.ts +59 -0
  154. package/dist/src/taint/fold.js +1177 -0
  155. package/dist/src/taint/fold.js.map +1 -0
  156. package/dist/src/taint/java-scope.d.ts +61 -0
  157. package/dist/src/taint/java-scope.js +212 -0
  158. package/dist/src/taint/java-scope.js.map +1 -0
  159. package/dist/src/taint/local-map.d.ts +79 -0
  160. package/dist/src/taint/local-map.js +603 -0
  161. package/dist/src/taint/local-map.js.map +1 -0
  162. package/dist/src/taint/project.d.ts +172 -0
  163. package/dist/src/taint/project.js +617 -0
  164. package/dist/src/taint/project.js.map +1 -0
  165. package/dist/src/taint/tracer.d.ts +265 -0
  166. package/dist/src/taint/tracer.js +3817 -0
  167. package/dist/src/taint/tracer.js.map +1 -0
  168. package/dist/src/taint/types.d.ts +484 -0
  169. package/dist/src/taint/types.js +47 -0
  170. package/dist/src/taint/types.js.map +1 -0
  171. package/dist/src/taint/visibility.d.ts +25 -0
  172. package/dist/src/taint/visibility.js +96 -0
  173. package/dist/src/taint/visibility.js.map +1 -0
  174. package/docs/examples/defuse.json +20 -0
  175. package/docs/examples/dvwa-urls.json +14 -0
  176. package/docs/examples/github-code-scanning.yml +54 -0
  177. package/docs/examples/tiny.js +4 -0
  178. package/package.json +73 -4
  179. package/src/cli.ts +747 -0
  180. package/src/core/analyze.ts +1072 -0
  181. package/src/core/coverage.ts +269 -0
  182. package/src/core/finding.ts +311 -0
  183. package/src/core/licence.ts +61 -0
  184. package/src/core/paths.ts +59 -0
  185. package/src/core/score.ts +353 -0
  186. package/src/dast/targets.ts +121 -0
  187. package/src/dast/zap.ts +246 -0
  188. package/src/engine/scan.ts +200 -0
  189. package/src/engine/shapes.ts +348 -0
  190. package/src/engine/walk.ts +196 -0
  191. package/src/parse/astDump.ts +85 -0
  192. package/src/parse/languages.ts +232 -0
  193. package/src/parse/location.ts +44 -0
  194. package/src/parse/node-grammars.ts +41 -0
  195. package/src/parse/parser.ts +262 -0
  196. package/src/parse/tree-store.ts +301 -0
  197. package/src/platform/dependency-rule.ts +33 -0
  198. package/src/platform/deps.ts +374 -0
  199. package/src/platform/php-facts.ts +85 -0
  200. package/src/platform/runtime-version.ts +710 -0
  201. package/src/report/colors.ts +107 -0
  202. package/src/report/coverage-table.ts +359 -0
  203. package/src/report/html-report.ts +601 -0
  204. package/src/report/human.ts +811 -0
  205. package/src/report/json.ts +189 -0
  206. package/src/report/mark.ts +47 -0
  207. package/src/report/pricing.ts +374 -0
  208. package/src/report/sarif.ts +235 -0
  209. package/src/report/site.ts +760 -0
  210. package/src/rules/code-injection.ts +346 -0
  211. package/src/rules/command-injection.ts +296 -0
  212. package/src/rules/contract.ts +220 -0
  213. package/src/rules/format-string.ts +158 -0
  214. package/src/rules/hardcoded-secret.ts +485 -0
  215. package/src/rules/lib/guards.ts +1235 -0
  216. package/src/rules/lib/html-safety.ts +793 -0
  217. package/src/rules/lib/local-build.ts +329 -0
  218. package/src/rules/lib/strings.ts +2034 -0
  219. package/src/rules/path-traversal.ts +101 -0
  220. package/src/rules/registry.ts +90 -0
  221. package/src/rules/sql-injection.ts +311 -0
  222. package/src/rules/ssrf.ts +118 -0
  223. package/src/rules/unbounded-copy.ts +162 -0
  224. package/src/rules/unsafe-deserialization.ts +291 -0
  225. package/src/rules/weak-hash.ts +226 -0
  226. package/src/rules/xss.ts +572 -0
  227. package/src/taint/content-type.ts +20 -0
  228. package/src/taint/dictionaries.ts +1855 -0
  229. package/src/taint/fold.ts +1206 -0
  230. package/src/taint/java-scope.ts +200 -0
  231. package/src/taint/local-map.ts +594 -0
  232. package/src/taint/project.ts +774 -0
  233. package/src/taint/tracer.ts +4298 -0
  234. package/src/taint/types.ts +511 -0
  235. package/src/taint/visibility.ts +100 -0
  236. package/tsconfig.json +61 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../../src/core/analyze.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,mBAAmB,EAAuB,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAGhB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAA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,CAAC,QAAQ;QAChC,QAAQ,EAAE,KAAK,CAAC,GAAG;QACnB,kBAAkB,EAAE,KAAK,CAAC,KAAK;QAC/B,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;KAClD,CAAC,CAAC;SACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAEhD,OAAO;QACL,QAAQ,EAAE,WAAW;QACrB,aAAa;QACb,eAAe;QACf,uBAAuB;QACvB,sBAAsB;QACtB,SAAS;QACT,WAAW;QACX,KAAK,EAAE;YACL,WAAW;YACX,YAAY;YACZ,cAAc;YACd,aAAa,EAAE,YAAY,CAAC,MAAM;YAClC,kBAAkB;YAClB,mBAAmB;YACnB,wBAAwB,EAAE,kBAAkB,CAAC,IAAI;YACjD,wBAAwB,EAAE,eAAe,CAAC,MAAM;YAChD,uBAAuB,EAAE,uBAAuB,CAAC,MAAM;YACvD,sBAAsB,EAAE,sBAAsB,CAAC,MAAM;YACrD,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO;SACjC;QACD,UAAU;QACV,aAAa;QACb,YAAY;QACZ,SAAS,EAAE,YAAY;YACrB,CAAC,CAAC,EAAE,OAAO,EAAE,IAAa,EAAE,GAAG,YAAY,CAAC,KAAK,EAAE,EAAE;YACrD,CAAC,CAAC,EAAE,OAAO,EAAE,KAAc,EAAE,MAAM,EAAE,kBAAkB,EAAE;QAC3D,UAAU,EAAE,cAAc;QAC1B,QAAQ,EAAE,mBAAmB,EAAE;KAChC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * THE COVERAGE LEDGER - "no silent gaps"
3
+ * ======================================
4
+ *
5
+ * Most scanners tell you what they FOUND. Almost none tell you what they did
6
+ * not LOOK for. That asymmetry is how a clean report comes to mean "we are
7
+ * secure" when it actually means "we ran five checks on two of your six
8
+ * languages".
9
+ *
10
+ * This module turns the per-rule, per-language declarations in the rule files
11
+ * into a ledger that is printed at the end of EVERY scan - clean or not. If a
12
+ * rule is partial, the report says which part. If a language went unscanned,
13
+ * the report says so and says why.
14
+ *
15
+ * A gap you can read is a decision. A gap you cannot read is a lie by omission.
16
+ */
17
+ import type { SupportStatus } from '../rules/contract.js';
18
+ import { type LanguageId } from '../parse/languages.js';
19
+ import { ENGINE_CAPABILITIES } from './finding.js';
20
+ export interface CoverageCell {
21
+ readonly ruleId: string;
22
+ readonly ruleName: string;
23
+ readonly language: LanguageId;
24
+ readonly status: SupportStatus;
25
+ readonly note: string;
26
+ }
27
+ /** Which languages the data-flow engine can actually verify flows in. */
28
+ export interface TaintCoverageCell {
29
+ readonly language: LanguageId;
30
+ readonly implemented: boolean;
31
+ readonly note: string;
32
+ }
33
+ export interface CoverageReport {
34
+ readonly engine: typeof ENGINE_CAPABILITIES;
35
+ /**
36
+ * Data-flow coverage is reported SEPARATELY from rule coverage, because a
37
+ * language can have every rule implemented and still get no flow
38
+ * verification at all - which is exactly the situation Java and Go are in.
39
+ * Folding the two together would let "5/5 rules implemented" imply a depth
40
+ * of analysis that does not exist there.
41
+ */
42
+ readonly taint: readonly TaintCoverageCell[];
43
+ /** Every rule x language combination, including the ones we do not do. */
44
+ readonly matrix: readonly CoverageCell[];
45
+ /** Only the cells a reader must act on: partial and not-implemented. */
46
+ readonly gaps: readonly CoverageCell[];
47
+ readonly counts: {
48
+ readonly rules: number;
49
+ readonly languages: number;
50
+ readonly implemented: number;
51
+ readonly partial: number;
52
+ readonly notImplemented: number;
53
+ };
54
+ /** Languages present in the scanned tree that we have no support for at all. */
55
+ readonly unscannedExtensions: readonly string[];
56
+ /**
57
+ * OWASP categories this engine has NO rule for. Not a gap within a rule -
58
+ * the absence of the rule entirely.
59
+ *
60
+ * The report already listed limits inside the checks it runs, and partial
61
+ * language coverage per rule. It never said which whole classes of bug it
62
+ * does not look for. So a Java scan that stays silent on XXE and insecure
63
+ * deserialization reads exactly like a Java scan where those things are fine,
64
+ * and there was nothing anywhere in the output to tell the two apart.
65
+ *
66
+ * That is the same failure as a green tick on an unread file, one level up.
67
+ */
68
+ readonly owaspCoverage: readonly CategoryCoverage[];
69
+ }
70
+ export interface CategoryCoverage {
71
+ readonly id: string;
72
+ readonly title: string;
73
+ /**
74
+ * Never 'full'. No category in this list is comprehensively checked, and a
75
+ * state the data can never reach should not exist in the type.
76
+ */
77
+ readonly state: 'none' | 'partial';
78
+ /** Rule ids that land in this category. Empty when state is 'none'. */
79
+ readonly rules: readonly string[];
80
+ /** What we DO check here. Only set when state is 'partial'. */
81
+ readonly weCheck?: string;
82
+ /** What a reader would plausibly expect here - covered or not. */
83
+ readonly examples: string;
84
+ /** Why it is absent, when the reason is structural rather than just "not yet". */
85
+ readonly note?: string;
86
+ }
87
+ export declare function buildCoverageReport(unscannedExtensions?: readonly string[]): CoverageReport;
@@ -0,0 +1,181 @@
1
+ /**
2
+ * THE COVERAGE LEDGER - "no silent gaps"
3
+ * ======================================
4
+ *
5
+ * Most scanners tell you what they FOUND. Almost none tell you what they did
6
+ * not LOOK for. That asymmetry is how a clean report comes to mean "we are
7
+ * secure" when it actually means "we ran five checks on two of your six
8
+ * languages".
9
+ *
10
+ * This module turns the per-rule, per-language declarations in the rule files
11
+ * into a ledger that is printed at the end of EVERY scan - clean or not. If a
12
+ * rule is partial, the report says which part. If a language went unscanned,
13
+ * the report says so and says why.
14
+ *
15
+ * A gap you can read is a decision. A gap you cannot read is a lie by omission.
16
+ */
17
+ import { ALL_RULES } from '../rules/registry.js';
18
+ import { LANGUAGES } from '../parse/languages.js';
19
+ import { TAINT_COVERAGE_NOTES, TAINT_DICTIONARIES } from '../taint/dictionaries.js';
20
+ import { ENGINE_CAPABILITIES } from './finding.js';
21
+ import { RUNTIME_VERSION_RULE } from '../platform/runtime-version.js';
22
+ import { DEPENDENCY_RULE } from '../platform/dependency-rule.js';
23
+ /**
24
+ * THE OWASP TOP 10, 2025 EDITION.
25
+ *
26
+ * Two corrections live in this block, and both were caught by someone asking
27
+ * "is that actually true?" of a panel built to be trusted.
28
+ *
29
+ * 1. THE EDITION WAS STALE. Every rule declared `A0x:2021`, and the coverage
30
+ * panel counted against the 2021 taxonomy. The 2025 edition superseded it -
31
+ * the numbering moved (Injection is A05 now, not A03), Software Supply Chain
32
+ * Failures arrived as its own category, and A10 is a new entry entirely. A
33
+ * tool that names a standard has to name the current one.
34
+ *
35
+ * 2. "COVERED" WAS A LIE OF ROUNDING. The first version of this list was a
36
+ * binary: a category counted as covered if ANY rule declared it. Three did,
37
+ * so the panel read "7 of 10 have no rule" - which invites the reader to
38
+ * conclude the other three are handled. They are not. Injection has one rule
39
+ * each for SQL, command and XSS, and none for LDAP, XPath, NoSQL, ORM,
40
+ * template or header injection. Cryptographic Failures is a single weak-hash
41
+ * check. Authentication Failures is hardcoded credentials and nothing else.
42
+ *
43
+ * So there is no `covered: true` state here, because nothing earns it. Every
44
+ * category is either untouched or PARTLY touched, and a partly-touched one
45
+ * has to say what it leaves out - otherwise the count does the same
46
+ * overstating the old binary did, one step further in.
47
+ */
48
+ const OWASP_2025 = [
49
+ {
50
+ id: 'A01:2025',
51
+ title: 'Broken Access Control',
52
+ examples: 'path traversal, missing authorisation checks, insecure direct object references',
53
+ note: 'Whether a check is MISSING needs a model of who may do what, which no syntax tree carries.',
54
+ },
55
+ {
56
+ id: 'A02:2025',
57
+ title: 'Security Misconfiguration',
58
+ examples: 'XXE (XML parser left with external entities enabled), debug mode on, permissive CORS',
59
+ note: 'XXE is an ABSENCE rule - the bug is a hardening call that was never written. Every rule here detects a presence, which is a different shape.',
60
+ },
61
+ {
62
+ id: 'A03:2025',
63
+ title: 'Software Supply Chain Failures',
64
+ examples: 'known-vulnerable dependency versions, unpinned or compromised packages',
65
+ note: 'Needs a lockfile and an advisory database, not a syntax tree.',
66
+ },
67
+ {
68
+ id: 'A04:2025',
69
+ title: 'Cryptographic Failures',
70
+ examples: 'weak ciphers, missing TLS, weak randomness, unsalted hashes',
71
+ },
72
+ {
73
+ id: 'A05:2025',
74
+ title: 'Injection',
75
+ examples: 'SQL, command, XSS, LDAP, XPath, NoSQL, ORM, template and header injection',
76
+ },
77
+ {
78
+ id: 'A06:2025',
79
+ title: 'Insecure Design',
80
+ examples: 'missing rate limits, unsafe workflows',
81
+ note: 'A design flaw is not a code pattern; static analysis cannot see it.',
82
+ },
83
+ {
84
+ id: 'A07:2025',
85
+ title: 'Authentication Failures',
86
+ examples: 'hardcoded credentials, weak session handling, missing MFA, credential stuffing',
87
+ },
88
+ {
89
+ id: 'A08:2025',
90
+ title: 'Software or Data Integrity Failures',
91
+ examples: 'insecure deserialization (ObjectInputStream, pickle, unserialize), unsigned updates',
92
+ },
93
+ {
94
+ id: 'A09:2025',
95
+ title: 'Security Logging and Alerting Failures',
96
+ examples: 'absent audit logging, secrets written to logs, no alerting on abuse',
97
+ },
98
+ {
99
+ id: 'A10:2025',
100
+ title: 'Mishandling of Exceptional Conditions',
101
+ examples: 'swallowed errors, fail-open error paths, information leaked through error messages',
102
+ },
103
+ ];
104
+ /** What we DO check inside a category we only partly touch. */
105
+ const PARTIAL_NOTES = {
106
+ 'A04:2025': 'weak hash algorithms only',
107
+ 'A05:2025': 'SQL, command and XSS only',
108
+ 'A01:2025': 'server-side request forgery (a URL the server fetches that a request chose) and path traversal (a file path it opens that a request chose) only. Missing authorisation checks and IDOR are NOT checked: deciding whether a check is ABSENT needs a model of who may do what, which no syntax tree carries.',
109
+ 'A07:2025': 'hardcoded credentials in source only',
110
+ // This category used to be listed as unreachable, on the reasoning that
111
+ // deserialization is "structurally unlike a taint chain". That was wrong, and
112
+ // a Gemini-written test file proved it: `unserialize(base64_decode($_COOKIE
113
+ // ['session']))` is an ordinary source-to-sink flow with a source the engine
114
+ // already tracked. The claim was an assumption dressed up as an analysis.
115
+ 'A08:2025': 'deserialization of untrusted input only - unsigned updates and CI/CD integrity are not checked',
116
+ 'A03:2025': 'the PHP version a project declares (Dockerfile, compose, composer.json, .php-version), against php.net support dates and critical advisories only. Library versions are checked only with --deps (package-lock.json, composer.lock, requirements.txt, go.mod against osv.dev).',
117
+ };
118
+ /**
119
+ * Checks that are not shape rules - they read declarations rather than code -
120
+ * but still land in an OWASP category. Listed here so the coverage table
121
+ * counts them; leaving them out would understate what a scan does.
122
+ */
123
+ const PROJECT_CHECKS = [
124
+ { id: RUNTIME_VERSION_RULE.id, owasp: RUNTIME_VERSION_RULE.owasp },
125
+ { id: DEPENDENCY_RULE.id, owasp: DEPENDENCY_RULE.owasp },
126
+ ];
127
+ export function buildCoverageReport(unscannedExtensions = []) {
128
+ const matrix = [];
129
+ for (const rule of ALL_RULES) {
130
+ for (const language of LANGUAGES) {
131
+ const support = rule.support[language.id];
132
+ matrix.push({
133
+ ruleId: rule.id,
134
+ ruleName: rule.name,
135
+ language: language.id,
136
+ status: support?.status ?? 'not-implemented',
137
+ note: support?.note ??
138
+ 'NOT IMPLEMENTED: this rule has no pattern for this language, so files in ' +
139
+ 'this language were parsed but never checked for this weakness.',
140
+ });
141
+ }
142
+ }
143
+ const counts = {
144
+ rules: ALL_RULES.length,
145
+ languages: LANGUAGES.length,
146
+ implemented: matrix.filter((c) => c.status === 'implemented').length,
147
+ partial: matrix.filter((c) => c.status === 'partial').length,
148
+ notImplemented: matrix.filter((c) => c.status === 'not-implemented').length,
149
+ };
150
+ const taint = LANGUAGES.map((language) => ({
151
+ language: language.id,
152
+ implemented: TAINT_DICTIONARIES[language.id] !== undefined,
153
+ note: TAINT_COVERAGE_NOTES[language.id],
154
+ }));
155
+ return {
156
+ engine: ENGINE_CAPABILITIES,
157
+ taint,
158
+ matrix,
159
+ gaps: matrix.filter((c) => c.status !== 'implemented'),
160
+ counts,
161
+ unscannedExtensions: [...unscannedExtensions].sort(),
162
+ // Computed from the registry, so adding a rule quietly removes its category
163
+ // from this list and nobody has to remember to update prose.
164
+ owaspCoverage: OWASP_2025.map((category) => {
165
+ const rules = [...ALL_RULES, ...PROJECT_CHECKS]
166
+ .filter((rule) => rule.owasp.startsWith(category.id))
167
+ .map((r) => r.id);
168
+ const partial = PARTIAL_NOTES[category.id];
169
+ return {
170
+ id: category.id,
171
+ title: category.title,
172
+ state: rules.length > 0 ? 'partial' : 'none',
173
+ rules,
174
+ ...(rules.length > 0 && partial ? { weCheck: partial } : {}),
175
+ examples: category.examples,
176
+ ...(category.note ? { note: category.note } : {}),
177
+ };
178
+ }),
179
+ };
180
+ }
181
+ //# sourceMappingURL=coverage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../../src/core/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAmB,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAyEjE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,GAKV;IACJ;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,uBAAuB;QAC9B,QAAQ,EAAE,iFAAiF;QAC3F,IAAI,EAAE,4FAA4F;KACnG;IACD;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,2BAA2B;QAClC,QAAQ,EAAE,sFAAsF;QAChG,IAAI,EAAE,8IAA8I;KACrJ;IACD;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,gCAAgC;QACvC,QAAQ,EAAE,wEAAwE;QAClF,IAAI,E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,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,196 @@
1
+ /**
2
+ * THE HONESTY CONTRACT
3
+ * ====================
4
+ *
5
+ * This file is the most important file in the project. Everything else is
6
+ * plumbing. Read this one carefully.
7
+ *
8
+ * Defuse promises one thing that Snyk / Semgrep / SonarQube do not
9
+ * promise clearly: every single finding tells you HOW SURE we are, in a way you
10
+ * can act on. There are exactly two levels, and they mean precise things:
11
+ *
12
+ * "signature-based" We matched a SHAPE in your code. We saw a pattern that
13
+ * is *often* a vulnerability. We did NOT trace where the
14
+ * data actually came from. This might be a real bug, or it
15
+ * might be completely safe. YOU still have to look.
16
+ *
17
+ * "flow-verified" We traced actual data, step by step, from a place an
18
+ * attacker controls (a "source", e.g. an HTTP request)
19
+ * all the way into a dangerous operation (a "sink", e.g.
20
+ * a database query), and we confirmed nothing cleaned it
21
+ * up along the way. We can show you every hop.
22
+ *
23
+ * A RULE CAN ONLY EVER PRODUCE "signature-based". Only the taint engine can
24
+ * produce the other label.
25
+ *
26
+ * We do not enforce that with willpower or a code review checklist. We enforce
27
+ * it with the type system:
28
+ *
29
+ * - A FlowVerifiedFinding REQUIRES a non-empty `flowPath` of concrete steps.
30
+ * - Only the taint engine can build one. A rule cannot, because a rule only
31
+ * ever sees a single shape - it has no idea where the value came from.
32
+ * - So a rule physically cannot emit a "flow-verified" finding: there is no
33
+ * path it could supply, and TypeScript refuses to compile the attempt.
34
+ *
35
+ * That is the difference between a promise and a guarantee.
36
+ *
37
+ * ARCHITECTURAL DECISION (matters later): we are modelling Finding as a
38
+ * "discriminated union" - two shapes sharing one `confidence` tag - rather than
39
+ * one flat object with an optional flag. The taint engine supplies the second
40
+ * shape, and every report renderer is forced by the compiler to handle it.
41
+ * Nothing silently upgrades its own confidence.
42
+ */
43
+ /** The two - and only two - confidence levels this tool will ever emit. */
44
+ export type Confidence = 'signature-based' | 'flow-verified';
45
+ /**
46
+ * Severity = "how bad is this if it turns out to be real?"
47
+ * Deliberately separate from confidence, which is "how sure are we it's real?"
48
+ * Conflating those two numbers is the single most common lie in SAST tooling:
49
+ * a tool shows one "risk" bar and you cannot tell whether it means
50
+ * "probably harmless but catastrophic if not" or "definitely real but minor".
51
+ */
52
+ export type Severity = 'critical' | 'high' | 'medium' | 'low' | 'info';
53
+ export declare const SEVERITY_ORDER: Record<Severity, number>;
54
+ /**
55
+ * Exactly where in the code this was found.
56
+ * We keep the raw AST node type and its ancestry so a finding is reproducible:
57
+ * you can point at the same node again later and check whether we were right.
58
+ */
59
+ export interface CodeLocation {
60
+ /** Path as the user gave it to us (relative where possible - nicer to read). */
61
+ readonly file: string;
62
+ /** 1-based, because humans and editors count from 1. Tree-sitter counts from 0. */
63
+ readonly startLine: number;
64
+ readonly startColumn: number;
65
+ readonly endLine: number;
66
+ readonly endColumn: number;
67
+ /** The tree-sitter node type we matched, e.g. "binary_expression". */
68
+ readonly astNodeType: string;
69
+ /** Ancestry of that node, e.g. "program > lexical_declaration > call_expression". */
70
+ readonly astNodePath: string;
71
+ /** The exact source text that matched, trimmed for display. */
72
+ readonly snippet: string;
73
+ }
74
+ /**
75
+ * One hop in a data-flow trace. Produced only by the taint engine, which is the
76
+ * only component that watches a value move. Defined as a public, reviewable
77
+ * shape rather than a vague promise: if a hop cannot be described and located,
78
+ * it does not belong in a path.
79
+ */
80
+ export interface FlowStep {
81
+ readonly kind: 'source' | 'propagation' | 'sanitizer' | 'sink';
82
+ readonly location: CodeLocation;
83
+ readonly description: string;
84
+ }
85
+ interface FindingBase {
86
+ /** Stable machine id, e.g. "sql-injection". Used by --json and by tests. */
87
+ readonly ruleId: string;
88
+ /** Human title, e.g. "SQL query built by string concatenation". */
89
+ readonly ruleName: string;
90
+ /** Common Weakness Enumeration id, the industry's shared bug catalogue. */
91
+ readonly cwe: string;
92
+ /** Which OWASP Top 10 (2025) category this belongs to. */
93
+ readonly owasp: string;
94
+ readonly severity: Severity;
95
+ /** One line, plain language, shown in terminal output. */
96
+ readonly message: string;
97
+ readonly location: CodeLocation;
98
+ /**
99
+ * WHY did this match? Written for a human who is deciding whether to care.
100
+ * Required, never optional - a finding with no explanation is a guess with a
101
+ * badge on.
102
+ */
103
+ readonly reasoning: string;
104
+ /**
105
+ * What this particular check CANNOT tell you. Required for the same reason.
106
+ * e.g. "We did not check whether `userId` is attacker-controlled."
107
+ */
108
+ readonly limitations: string;
109
+ /** ISO-8601 timestamp of the scan that produced this. */
110
+ readonly detectedAt: string;
111
+ }
112
+ /** A pattern match. Unverified by design - this is what the rule engine emits. */
113
+ export interface SignatureFinding extends FindingBase {
114
+ readonly confidence: 'signature-based';
115
+ readonly verified: false;
116
+ /** Explicitly null, not missing: "we looked at flow" is never implied. */
117
+ readonly flowPath: null;
118
+ }
119
+ /** A confirmed source-to-sink trace. Only the taint engine can construct one. */
120
+ export interface FlowVerifiedFinding extends FindingBase {
121
+ readonly confidence: 'flow-verified';
122
+ readonly verified: true;
123
+ /** Must contain at least a source and a sink. Enforced at construction. */
124
+ readonly flowPath: readonly FlowStep[];
125
+ /**
126
+ * Functions on this path that we do not model, named.
127
+ *
128
+ * THE WEAKEST LINK, PROMOTED TO A FIELD. `flow-verified` promises the value
129
+ * was traced with no sanitiser on the path. When a hop passes through a
130
+ * function we have never heard of, "no sanitiser" is an ASSUMPTION rather
131
+ * than an observation - if that function sanitises, the finding is wrong.
132
+ *
133
+ * The path step and the prose limitations both said so already. This did not:
134
+ * a consumer filtering `confidence === 'flow-verified'` out of --json got the
135
+ * unqualified promise with no way to tell a fully-modelled trace from one
136
+ * resting on an assumption. A caveat that only exists in prose is a caveat
137
+ * machines cannot honour, which makes it half a caveat.
138
+ *
139
+ * Empty means every hop on this path is modelled. That is the strong case.
140
+ */
141
+ readonly unmodelledHops: readonly string[];
142
+ }
143
+ export type Finding = SignatureFinding | FlowVerifiedFinding;
144
+ /**
145
+ * The constructor for everything the RULE engine produces.
146
+ *
147
+ * Note what it does not accept: there is no `confidence` parameter. A rule
148
+ * author cannot pass "flow-verified" even by mistake, because the value is
149
+ * hard-coded here and nowhere else.
150
+ */
151
+ export declare function signatureFinding(input: Omit<FindingBase, 'detectedAt'> & {
152
+ detectedAt?: string;
153
+ }): SignatureFinding;
154
+ /**
155
+ * THE SECOND CONSTRUCTOR.
156
+ *
157
+ * For the whole first stretch of this project, this function threw. It was a
158
+ * deliberate, documented stub: the type for a flow-verified finding existed, so
159
+ * anyone could read what the claim would REQUIRE, but nothing could produce one.
160
+ *
161
+ * It is real now, and the requirement did not soften. Note the runtime checks
162
+ * below: a flow-verified finding must carry a path that BEGINS at a source and
163
+ * ENDS at a sink. Not "a path". Not "some steps". If the taint engine ever
164
+ * hands over a path that doesn't start where attacker data enters and finish
165
+ * where it does damage, this throws rather than emitting the claim.
166
+ *
167
+ * The type system stops a rule from lying. This function stops the ENGINE from
168
+ * lying - including a future version of it written by someone in a hurry.
169
+ */
170
+ export declare function flowVerifiedFinding(input: Omit<FindingBase, 'detectedAt'> & {
171
+ detectedAt?: string;
172
+ flowPath: readonly FlowStep[];
173
+ unmodelledHops?: readonly string[];
174
+ }): FlowVerifiedFinding;
175
+ /** What this build of the engine can and cannot do. Printed in every report. */
176
+ export declare const ENGINE_CAPABILITIES: {
177
+ /**
178
+ * What the banner prints, on the terminal and in the browser.
179
+ *
180
+ * A phase number used to live here. It described OUR build order, not
181
+ * anything a user of the tool can act on - and it went stale the moment work
182
+ * happened out of order: the banner read "PHASE 3C" while the version string
183
+ * read "phase2", which is precisely the kind of small lie this project exists
184
+ * to not tell. A capability label cannot drift, because it can only change
185
+ * when the engine actually changes.
186
+ */
187
+ readonly analysisLabel: "SIGNATURE + DATA FLOW";
188
+ readonly version: "0.5.0";
189
+ readonly implemented: readonly [`Tree-sitter AST parsing for ${string}`, "Pattern (signature) matching over real syntax trees, not text/regex", `Taint analysis in all ${number} languages: source to sink, following values into other functions AND - in every language except PHP - into other files through resolved imports`, "Prepared-statement awareness: arguments bound to a prepared query are parameters, not instructions", "Kind-scoped sanitiser recognition - an HTML escaper does not clear a SQL sink", "Retraction: a signature guess is withdrawn when the tracer proves a sanitiser runs", "Verified-clean reporting: lines the tracer reached and proved safe are listed, so \"no finding here\" can be told apart from \"never looked here\"", "One engine, two shells: the terminal and the browser run the same compiled analysis module, not two implementations of it", "Receiver state: a tainted argument dirties the object it was handed to, so `sb.append(dirty)` and `list.add(dirty)` are followed - and a sink that takes NO arguments because the payload was loaded earlier (`pb.command(list); pb.start()`) is recognised", "Return-value sinks in Python: a Flask/Django view that returns an HTML string is treated as writing the response body, so the commonest reflected XSS in Python is seen at all - and the escaped version is credited as clean rather than merely unflagged", "Escape proof before complaint (JavaScript/TypeScript): before reporting a value written into HTML, local variables, local render helpers and their arguments are resolved to see whether every spliced-in value is a literal, a number, or the output of a known escaper. A finding that survives names the exact sub-expression it could not prove safe.", "SQL is recognised by statement SHAPE (SELECT paired with FROM, INSERT with INTO) inside a bounded window, not by keywords scattered anywhere in the text - so a paragraph of prose containing \"call\" and \"where\" is not a query", "Per-rule and per-language coverage reporting, including gaps"];
190
+ readonly notImplemented: readonly ["Third-party code: only files inside the scan are resolved. A call into node_modules, a JAR or a vendored package ends the trace.", "Ambiguous imports: when several files in scope define the same function name, we decline to guess and the trace stops there. The count is reported.", "Re-exports, dynamic imports, computed requires, and build-tool path aliases (tsconfig paths, webpack) are not resolved.", "Whether a function is actually EXPORTED is not checked - a module-private helper with a matching name could be entered.", "Call chains deeper than four functions are not followed, and a call that resolves by name to a function already being followed on the same path - recursion, or a same-named method on another object - is not re-entered. At either stop the value is carried on as an ASSUMPTION that the unread call preserves it, and the finding names the call and why it was not read. So a sanitiser hidden past a stop is missed and the line is reported; before this was fixed the stop declared the value clean, which cost BenchmarkJava 38 real vulnerabilities.", "Calls are resolved by NAME, with two checks where the language makes them sound: in Java, Go, C and C++ a call must pass a number of arguments the target accepts, and in Java a call on a receiver of a declared type only reaches methods declared in that type. An interface-typed receiver therefore reaches no body at all, and the value is carried past it as a named assumption.", "Object and field state: `obj.field = dirty` and `sb.append(dirty)` are invisible - we track variables, not the interiors of objects.", "Sources are recognised by expression shape (req.query, request.form), not by proving the object really is a request.", "Branch conditions are evaluated only when they are fixed at compile time: literals, arithmetic, comparisons and logic over them, a local DECLARED once with such a value (in Python, PHP and a JavaScript `var`: written once at the top of the function, since those have no block-scoped declarations), a character literal, and Java's `charAt` on a string literal. A name that is a parameter, a field, incremented, passed by address or reference, part of a destructuring or multi-value write, or written more than once is not fixed; nor is anything in C++ unless it is declared const or constexpr, since a reference can write to it invisibly; nor anything in a function that uses eval, with, arguments, $$name, extract() or exec(), that C code can goto into, or that did not parse cleanly. Only exact arithmetic is folded: no octal literals, no division outside integer languages, and no value outside the range its declared type holds. Such a condition decides `if`, ternaries and switch statements (Java, JavaScript, TypeScript, C, C++, PHP and Go - not Python's `match`); strings are never compared, so a switch on a string stays undecided. Every branch or case skipped this way is listed in diagnostics.unreachableCodeSkipped with the decision behind it. Every other condition is not read, so we make the weaker claim that a CONDITIONAL write cannot prove a value clean: taint set anywhere survives a clean assignment inside an if/else, switch or loop, while an unconditional one still clears it. That errs toward reporting a value that might be clean rather than staying silent about one that might be dirty - and it is why `if (cond) bar = dirty; else bar = \"safe\";` is still reported.", "Loops are not iterated to a fixpoint, so a value that becomes tainted late in a loop body is missed.", "Containers are tainted whole, not per element: after `list.add(clean)` and `list.add(dirty)`, or after `Object[] a = {\"safe\", dirty}`, every read from that container is treated as dirty. This is the price of following values into objects at all, and it errs toward reporting rather than missing. TWO EXCEPTIONS, Java only, where every write the collection can receive is visible: a map created locally as `new HashMap<>()` or `new LinkedHashMap<>()` and touched by nothing but straight-line `put(\"literal\", value);` statements and reads answers `get(\"literal\")` with the last put under that key; and a list created locally as `new ArrayList<>()` or `new LinkedList<>()` and touched by nothing but straight-line `add(value);` and `remove(n);` statements and reads is replayed, so `get(n)` returns what sits at that position. Anything else - a conditional write, a variable key or index, the collection handed to anything, any other method - keeps the whole-collection answer. A stored value that can change in place (a StringBuilder, an array, a list) is not read this way, since an alias could change it unseen. Every read answered this way is listed in diagnostics.collectionReadsResolved.", "Framework awareness is PER-FRAMEWORK and partial. Recognised: Express/Koa request objects, Flask/Django/DRF request objects, URL path parameters named by a Flask or FastAPI route decorator, NestJS @Param/@Query/@Body/@Headers parameters, Spring and JAX-RS parameter annotations, servlet getters, net/http and Gin/Echo context values, PHP superglobals and $request accessors. NOT recognised, and each one is a silent zero: any house-built REST layer (elasticsearch's own RestRequest is 783 uses in one repository), Micronaut, Quarkus outside JAX-RS, Vert.x, Play, NestJS decorators other than @Param, @Query, @Body and @Headers, FastAPI query parameters a route path does not name and Pydantic body models, and Express ROUTING itself - a value that only becomes attacker-controlled through a framework binding we do not list is never seen as a source. The report now prints how many sources were recognised, so a zero is visible rather than reading as a clean bill.", "The escape proof is JavaScript and TypeScript only, and same-file only. An escaper imported from another module, applied by a framework, or reached through more than six nested calls reads as unproven - so Python, Java, PHP and Go HTML sinks still report on shape alone.", "MEMORY SCALES WITH THE SOURCE, at roughly 7x its bytes plus a fixed ~300MB for Node and the seven WebAssembly grammars. Syntax trees live in a WASM heap that JavaScript garbage collection cannot touch, so they are freed explicitly: the scan holds as many as DEFUSE_TREE_BUDGET_MB allows and parses a file again if something needs it after its tree was dropped. Measured on one 54MB corpus, same binary, only the budget changed: 1474MB peak holding everything, 716MB with a 256MB tree budget, findings byte-identical, 7% slower. That puts the practical ceiling near 1.1GB of source on an 8GB machine. A scan that does not fit gets SLOWER rather than being killed, and the report says so - diagnostics.treeMemory.reparses above zero means files were parsed more than once. THE PREVIOUS VERSION OF THIS NOTE WAS WRONG, and is recorded here rather than quietly deleted: it said trees were never freed \"because cross-file tracing needs to resolve into any file at any time\", and cited a 120MB ceiling. Cross-file had nothing to do with it - measured, --no-cross-file used 535.8MB against 528.8MB with it on, because nothing called delete() in either mode. The ceiling was real; the explanation for it was invented.", "Expressions nested deeper than 400 levels are not walked. Hand-written code never reaches this; generated, minified and stress-test files do. The count is reported as a blind spot rather than silently skipped - an earlier version had no limit at all and one such file killed an entire 25,809-file scan with a stack overflow, losing every finding in it.", "Vendor documentation example credentials (a key matching a published format but ending in EXAMPLE, or filled with 0000/1234567890) are treated as placeholders and not reported. A real credential that happened to look like one would be missed."];
191
+ readonly meaningOfConfidence: {
192
+ readonly 'signature-based': "Pattern matched in the syntax tree. Data flow NOT traced. May be a false positive.";
193
+ readonly 'flow-verified': "Attacker-controlled data was traced from a source into a sink - across functions and, where imports resolve, across files - with no sanitiser on the path. Every hop is listed in flowPath, with its own file and line.";
194
+ };
195
+ };
196
+ export {};