@defai.digital/ax-cli 3.15.21 → 3.15.24

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 (261) hide show
  1. package/README.md +22 -2
  2. package/dist/agent/agent-executor.d.ts +1 -1
  3. package/dist/agent/agent-executor.js +15 -17
  4. package/dist/agent/agent-executor.js.map +1 -1
  5. package/dist/agent/execution/tool-executor.d.ts +6 -0
  6. package/dist/agent/execution/tool-executor.js +16 -1
  7. package/dist/agent/execution/tool-executor.js.map +1 -1
  8. package/dist/agent/llm-agent.js +91 -22
  9. package/dist/agent/llm-agent.js.map +1 -1
  10. package/dist/agent/parallel-tools.d.ts +65 -0
  11. package/dist/agent/parallel-tools.js +146 -0
  12. package/dist/agent/parallel-tools.js.map +1 -0
  13. package/dist/llm/tools.js +1 -1
  14. package/dist/llm/tools.js.map +1 -1
  15. package/dist/ui/components/chat-interface.js +14 -0
  16. package/dist/ui/components/chat-interface.js.map +1 -1
  17. package/dist/ui/hooks/use-input-handler.js +2 -2
  18. package/dist/ui/hooks/use-input-handler.js.map +1 -1
  19. package/dist/ui/utils/image-handler.js +8 -5
  20. package/dist/ui/utils/image-handler.js.map +1 -1
  21. package/package.json +1 -1
  22. package/dist/analyzers/architecture/anti-pattern-detectors/god-object-detector.d.ts +0 -29
  23. package/dist/analyzers/architecture/anti-pattern-detectors/god-object-detector.js +0 -103
  24. package/dist/analyzers/architecture/anti-pattern-detectors/god-object-detector.js.map +0 -1
  25. package/dist/analyzers/architecture/architecture-analyzer.d.ts +0 -58
  26. package/dist/analyzers/architecture/architecture-analyzer.js +0 -276
  27. package/dist/analyzers/architecture/architecture-analyzer.js.map +0 -1
  28. package/dist/analyzers/architecture/index.d.ts +0 -12
  29. package/dist/analyzers/architecture/index.js +0 -14
  30. package/dist/analyzers/architecture/index.js.map +0 -1
  31. package/dist/analyzers/architecture/pattern-detectors/base-detector.d.ts +0 -27
  32. package/dist/analyzers/architecture/pattern-detectors/base-detector.js +0 -31
  33. package/dist/analyzers/architecture/pattern-detectors/base-detector.js.map +0 -1
  34. package/dist/analyzers/architecture/pattern-detectors/clean-architecture-detector.d.ts +0 -11
  35. package/dist/analyzers/architecture/pattern-detectors/clean-architecture-detector.js +0 -57
  36. package/dist/analyzers/architecture/pattern-detectors/clean-architecture-detector.js.map +0 -1
  37. package/dist/analyzers/architecture/pattern-detectors/mvc-detector.d.ts +0 -11
  38. package/dist/analyzers/architecture/pattern-detectors/mvc-detector.js +0 -43
  39. package/dist/analyzers/architecture/pattern-detectors/mvc-detector.js.map +0 -1
  40. package/dist/analyzers/architecture/pattern-detectors/repository-detector.d.ts +0 -11
  41. package/dist/analyzers/architecture/pattern-detectors/repository-detector.js +0 -49
  42. package/dist/analyzers/architecture/pattern-detectors/repository-detector.js.map +0 -1
  43. package/dist/analyzers/architecture/project-structure-scanner.d.ts +0 -54
  44. package/dist/analyzers/architecture/project-structure-scanner.js +0 -204
  45. package/dist/analyzers/architecture/project-structure-scanner.js.map +0 -1
  46. package/dist/analyzers/ast/index.d.ts +0 -13
  47. package/dist/analyzers/ast/index.js +0 -16
  48. package/dist/analyzers/ast/index.js.map +0 -1
  49. package/dist/analyzers/ast/language-parser.d.ts +0 -59
  50. package/dist/analyzers/ast/language-parser.js +0 -107
  51. package/dist/analyzers/ast/language-parser.js.map +0 -1
  52. package/dist/analyzers/ast/multi-language-parser.d.ts +0 -79
  53. package/dist/analyzers/ast/multi-language-parser.js +0 -157
  54. package/dist/analyzers/ast/multi-language-parser.js.map +0 -1
  55. package/dist/analyzers/ast/node-helpers.d.ts +0 -81
  56. package/dist/analyzers/ast/node-helpers.js +0 -128
  57. package/dist/analyzers/ast/node-helpers.js.map +0 -1
  58. package/dist/analyzers/ast/parser.d.ts +0 -60
  59. package/dist/analyzers/ast/parser.js +0 -305
  60. package/dist/analyzers/ast/parser.js.map +0 -1
  61. package/dist/analyzers/ast/traverser.d.ts +0 -67
  62. package/dist/analyzers/ast/traverser.js +0 -156
  63. package/dist/analyzers/ast/traverser.js.map +0 -1
  64. package/dist/analyzers/ast/types.d.ts +0 -107
  65. package/dist/analyzers/ast/types.js +0 -7
  66. package/dist/analyzers/ast/types.js.map +0 -1
  67. package/dist/analyzers/best-practices/base-rule.d.ts +0 -45
  68. package/dist/analyzers/best-practices/base-rule.js +0 -45
  69. package/dist/analyzers/best-practices/base-rule.js.map +0 -1
  70. package/dist/analyzers/best-practices/best-practice-validator.d.ts +0 -35
  71. package/dist/analyzers/best-practices/best-practice-validator.js +0 -181
  72. package/dist/analyzers/best-practices/best-practice-validator.js.map +0 -1
  73. package/dist/analyzers/best-practices/index.d.ts +0 -10
  74. package/dist/analyzers/best-practices/index.js +0 -11
  75. package/dist/analyzers/best-practices/index.js.map +0 -1
  76. package/dist/analyzers/best-practices/rules/index.d.ts +0 -7
  77. package/dist/analyzers/best-practices/rules/index.js +0 -56
  78. package/dist/analyzers/best-practices/rules/index.js.map +0 -1
  79. package/dist/analyzers/best-practices/rules/typescript/consistent-naming.d.ts +0 -17
  80. package/dist/analyzers/best-practices/rules/typescript/consistent-naming.js +0 -41
  81. package/dist/analyzers/best-practices/rules/typescript/consistent-naming.js.map +0 -1
  82. package/dist/analyzers/best-practices/rules/typescript/function-complexity.d.ts +0 -27
  83. package/dist/analyzers/best-practices/rules/typescript/function-complexity.js +0 -76
  84. package/dist/analyzers/best-practices/rules/typescript/function-complexity.js.map +0 -1
  85. package/dist/analyzers/best-practices/rules/typescript/index.d.ts +0 -15
  86. package/dist/analyzers/best-practices/rules/typescript/index.js +0 -16
  87. package/dist/analyzers/best-practices/rules/typescript/index.js.map +0 -1
  88. package/dist/analyzers/best-practices/rules/typescript/max-file-length.d.ts +0 -18
  89. package/dist/analyzers/best-practices/rules/typescript/max-file-length.js +0 -25
  90. package/dist/analyzers/best-practices/rules/typescript/max-file-length.js.map +0 -1
  91. package/dist/analyzers/best-practices/rules/typescript/no-any-type.d.ts +0 -17
  92. package/dist/analyzers/best-practices/rules/typescript/no-any-type.js +0 -27
  93. package/dist/analyzers/best-practices/rules/typescript/no-any-type.js.map +0 -1
  94. package/dist/analyzers/best-practices/rules/typescript/no-implicit-any.d.ts +0 -18
  95. package/dist/analyzers/best-practices/rules/typescript/no-implicit-any.js +0 -39
  96. package/dist/analyzers/best-practices/rules/typescript/no-implicit-any.js.map +0 -1
  97. package/dist/analyzers/best-practices/rules/typescript/no-magic-numbers.d.ts +0 -17
  98. package/dist/analyzers/best-practices/rules/typescript/no-magic-numbers.js +0 -38
  99. package/dist/analyzers/best-practices/rules/typescript/no-magic-numbers.js.map +0 -1
  100. package/dist/analyzers/best-practices/rules/typescript/no-unused-vars.d.ts +0 -17
  101. package/dist/analyzers/best-practices/rules/typescript/no-unused-vars.js +0 -38
  102. package/dist/analyzers/best-practices/rules/typescript/no-unused-vars.js.map +0 -1
  103. package/dist/analyzers/best-practices/rules/typescript/prefer-const.d.ts +0 -17
  104. package/dist/analyzers/best-practices/rules/typescript/prefer-const.js +0 -35
  105. package/dist/analyzers/best-practices/rules/typescript/prefer-const.js.map +0 -1
  106. package/dist/analyzers/best-practices/rules/typescript/prefer-readonly.d.ts +0 -17
  107. package/dist/analyzers/best-practices/rules/typescript/prefer-readonly.js +0 -36
  108. package/dist/analyzers/best-practices/rules/typescript/prefer-readonly.js.map +0 -1
  109. package/dist/analyzers/best-practices/rules/typescript/proper-error-handling.d.ts +0 -17
  110. package/dist/analyzers/best-practices/rules/typescript/proper-error-handling.js +0 -27
  111. package/dist/analyzers/best-practices/rules/typescript/proper-error-handling.js.map +0 -1
  112. package/dist/analyzers/best-practices/types.d.ts +0 -86
  113. package/dist/analyzers/best-practices/types.js +0 -7
  114. package/dist/analyzers/best-practices/types.js.map +0 -1
  115. package/dist/analyzers/cache/analysis-cache.d.ts +0 -41
  116. package/dist/analyzers/cache/analysis-cache.js +0 -84
  117. package/dist/analyzers/cache/analysis-cache.js.map +0 -1
  118. package/dist/analyzers/code-smells/base-smell-detector.d.ts +0 -30
  119. package/dist/analyzers/code-smells/base-smell-detector.js +0 -44
  120. package/dist/analyzers/code-smells/base-smell-detector.js.map +0 -1
  121. package/dist/analyzers/code-smells/code-smell-analyzer.d.ts +0 -30
  122. package/dist/analyzers/code-smells/code-smell-analyzer.js +0 -167
  123. package/dist/analyzers/code-smells/code-smell-analyzer.js.map +0 -1
  124. package/dist/analyzers/code-smells/detectors/data-clumps-detector.d.ts +0 -11
  125. package/dist/analyzers/code-smells/detectors/data-clumps-detector.js +0 -64
  126. package/dist/analyzers/code-smells/detectors/data-clumps-detector.js.map +0 -1
  127. package/dist/analyzers/code-smells/detectors/dead-code-detector.d.ts +0 -11
  128. package/dist/analyzers/code-smells/detectors/dead-code-detector.js +0 -58
  129. package/dist/analyzers/code-smells/detectors/dead-code-detector.js.map +0 -1
  130. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.d.ts +0 -11
  131. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js +0 -69
  132. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js.map +0 -1
  133. package/dist/analyzers/code-smells/detectors/feature-envy-detector.d.ts +0 -11
  134. package/dist/analyzers/code-smells/detectors/feature-envy-detector.js +0 -70
  135. package/dist/analyzers/code-smells/detectors/feature-envy-detector.js.map +0 -1
  136. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.d.ts +0 -11
  137. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js +0 -59
  138. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js.map +0 -1
  139. package/dist/analyzers/code-smells/detectors/large-class-detector.d.ts +0 -13
  140. package/dist/analyzers/code-smells/detectors/large-class-detector.js +0 -61
  141. package/dist/analyzers/code-smells/detectors/large-class-detector.js.map +0 -1
  142. package/dist/analyzers/code-smells/detectors/long-method-detector.d.ts +0 -12
  143. package/dist/analyzers/code-smells/detectors/long-method-detector.js +0 -55
  144. package/dist/analyzers/code-smells/detectors/long-method-detector.js.map +0 -1
  145. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.d.ts +0 -12
  146. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js +0 -53
  147. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js.map +0 -1
  148. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.d.ts +0 -12
  149. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js +0 -56
  150. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js.map +0 -1
  151. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.d.ts +0 -13
  152. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js +0 -77
  153. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js.map +0 -1
  154. package/dist/analyzers/code-smells/index.d.ts +0 -16
  155. package/dist/analyzers/code-smells/index.js +0 -19
  156. package/dist/analyzers/code-smells/index.js.map +0 -1
  157. package/dist/analyzers/code-smells/types.d.ts +0 -82
  158. package/dist/analyzers/code-smells/types.js +0 -30
  159. package/dist/analyzers/code-smells/types.js.map +0 -1
  160. package/dist/analyzers/dependency/circular-detector.d.ts +0 -17
  161. package/dist/analyzers/dependency/circular-detector.js +0 -73
  162. package/dist/analyzers/dependency/circular-detector.js.map +0 -1
  163. package/dist/analyzers/dependency/coupling-calculator.d.ts +0 -24
  164. package/dist/analyzers/dependency/coupling-calculator.js +0 -86
  165. package/dist/analyzers/dependency/coupling-calculator.js.map +0 -1
  166. package/dist/analyzers/dependency/dependency-analyzer.d.ts +0 -44
  167. package/dist/analyzers/dependency/dependency-analyzer.js +0 -218
  168. package/dist/analyzers/dependency/dependency-analyzer.js.map +0 -1
  169. package/dist/analyzers/dependency/dependency-graph.d.ts +0 -57
  170. package/dist/analyzers/dependency/dependency-graph.js +0 -198
  171. package/dist/analyzers/dependency/dependency-graph.js.map +0 -1
  172. package/dist/analyzers/dependency/index.d.ts +0 -8
  173. package/dist/analyzers/dependency/index.js +0 -8
  174. package/dist/analyzers/dependency/index.js.map +0 -1
  175. package/dist/analyzers/dependency/types.d.ts +0 -105
  176. package/dist/analyzers/dependency/types.js +0 -5
  177. package/dist/analyzers/dependency/types.js.map +0 -1
  178. package/dist/analyzers/errors.d.ts +0 -51
  179. package/dist/analyzers/errors.js +0 -79
  180. package/dist/analyzers/errors.js.map +0 -1
  181. package/dist/analyzers/git/churn-calculator.d.ts +0 -36
  182. package/dist/analyzers/git/churn-calculator.js +0 -257
  183. package/dist/analyzers/git/churn-calculator.js.map +0 -1
  184. package/dist/analyzers/git/git-analyzer.d.ts +0 -19
  185. package/dist/analyzers/git/git-analyzer.js +0 -79
  186. package/dist/analyzers/git/git-analyzer.js.map +0 -1
  187. package/dist/analyzers/git/hotspot-detector.d.ts +0 -34
  188. package/dist/analyzers/git/hotspot-detector.js +0 -173
  189. package/dist/analyzers/git/hotspot-detector.js.map +0 -1
  190. package/dist/analyzers/git/index.d.ts +0 -7
  191. package/dist/analyzers/git/index.js +0 -7
  192. package/dist/analyzers/git/index.js.map +0 -1
  193. package/dist/analyzers/git/types.d.ts +0 -88
  194. package/dist/analyzers/git/types.js +0 -5
  195. package/dist/analyzers/git/types.js.map +0 -1
  196. package/dist/analyzers/metrics/halstead-calculator.d.ts +0 -30
  197. package/dist/analyzers/metrics/halstead-calculator.js +0 -150
  198. package/dist/analyzers/metrics/halstead-calculator.js.map +0 -1
  199. package/dist/analyzers/metrics/index.d.ts +0 -9
  200. package/dist/analyzers/metrics/index.js +0 -9
  201. package/dist/analyzers/metrics/index.js.map +0 -1
  202. package/dist/analyzers/metrics/maintainability-calculator.d.ts +0 -17
  203. package/dist/analyzers/metrics/maintainability-calculator.js +0 -46
  204. package/dist/analyzers/metrics/maintainability-calculator.js.map +0 -1
  205. package/dist/analyzers/metrics/metrics-analyzer.d.ts +0 -32
  206. package/dist/analyzers/metrics/metrics-analyzer.js +0 -144
  207. package/dist/analyzers/metrics/metrics-analyzer.js.map +0 -1
  208. package/dist/analyzers/metrics/types.d.ts +0 -67
  209. package/dist/analyzers/metrics/types.js +0 -5
  210. package/dist/analyzers/metrics/types.js.map +0 -1
  211. package/dist/analyzers/security/base-detector.d.ts +0 -58
  212. package/dist/analyzers/security/base-detector.js +0 -104
  213. package/dist/analyzers/security/base-detector.js.map +0 -1
  214. package/dist/analyzers/security/detectors/command-injection-detector.d.ts +0 -12
  215. package/dist/analyzers/security/detectors/command-injection-detector.js +0 -84
  216. package/dist/analyzers/security/detectors/command-injection-detector.js.map +0 -1
  217. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.d.ts +0 -16
  218. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js +0 -140
  219. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js.map +0 -1
  220. package/dist/analyzers/security/detectors/insecure-deserialization-detector.d.ts +0 -12
  221. package/dist/analyzers/security/detectors/insecure-deserialization-detector.js +0 -109
  222. package/dist/analyzers/security/detectors/insecure-deserialization-detector.js.map +0 -1
  223. package/dist/analyzers/security/detectors/insecure-random-detector.d.ts +0 -12
  224. package/dist/analyzers/security/detectors/insecure-random-detector.js +0 -61
  225. package/dist/analyzers/security/detectors/insecure-random-detector.js.map +0 -1
  226. package/dist/analyzers/security/detectors/path-traversal-detector.d.ts +0 -12
  227. package/dist/analyzers/security/detectors/path-traversal-detector.js +0 -82
  228. package/dist/analyzers/security/detectors/path-traversal-detector.js.map +0 -1
  229. package/dist/analyzers/security/detectors/sql-injection-detector.d.ts +0 -12
  230. package/dist/analyzers/security/detectors/sql-injection-detector.js +0 -88
  231. package/dist/analyzers/security/detectors/sql-injection-detector.js.map +0 -1
  232. package/dist/analyzers/security/detectors/weak-crypto-detector.d.ts +0 -12
  233. package/dist/analyzers/security/detectors/weak-crypto-detector.js +0 -104
  234. package/dist/analyzers/security/detectors/weak-crypto-detector.js.map +0 -1
  235. package/dist/analyzers/security/detectors/xss-detector.d.ts +0 -12
  236. package/dist/analyzers/security/detectors/xss-detector.js +0 -90
  237. package/dist/analyzers/security/detectors/xss-detector.js.map +0 -1
  238. package/dist/analyzers/security/index.d.ts +0 -16
  239. package/dist/analyzers/security/index.js +0 -18
  240. package/dist/analyzers/security/index.js.map +0 -1
  241. package/dist/analyzers/security/security-analyzer.d.ts +0 -38
  242. package/dist/analyzers/security/security-analyzer.js +0 -215
  243. package/dist/analyzers/security/security-analyzer.js.map +0 -1
  244. package/dist/analyzers/security/types.d.ts +0 -95
  245. package/dist/analyzers/security/types.js +0 -7
  246. package/dist/analyzers/security/types.js.map +0 -1
  247. package/dist/tools/analysis-tools/architecture-tool.d.ts +0 -46
  248. package/dist/tools/analysis-tools/architecture-tool.js +0 -124
  249. package/dist/tools/analysis-tools/architecture-tool.js.map +0 -1
  250. package/dist/tools/analysis-tools/validation-tool.d.ts +0 -51
  251. package/dist/tools/analysis-tools/validation-tool.js +0 -121
  252. package/dist/tools/analysis-tools/validation-tool.js.map +0 -1
  253. package/dist/tools/analysis-tools.d.ts +0 -73
  254. package/dist/tools/analysis-tools.js +0 -422
  255. package/dist/tools/analysis-tools.js.map +0 -1
  256. package/dist/types/analysis.d.ts +0 -177
  257. package/dist/types/analysis.js +0 -8
  258. package/dist/types/analysis.js.map +0 -1
  259. package/dist/utils/analysis-logger.d.ts +0 -50
  260. package/dist/utils/analysis-logger.js +0 -73
  261. package/dist/utils/analysis-logger.js.map +0 -1
@@ -1,61 +0,0 @@
1
- /**
2
- * Insecure Random Detector
3
- *
4
- * Detects use of cryptographically weak random number generators
5
- * OWASP A02:2021 - Cryptographic Failures
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- export class InsecureRandomDetector extends BaseSecurityDetector {
9
- constructor() {
10
- super({
11
- id: 'insecure-random',
12
- name: 'Insecure Random Number Generation',
13
- description: 'Detects use of Math.random() for security-sensitive operations',
14
- severity: 'medium',
15
- owaspCategory: 'A02:2021 - Cryptographic Failures',
16
- cweId: 'CWE-338',
17
- });
18
- }
19
- async scan(content, filePath) {
20
- if (!this.appliesTo(filePath)) {
21
- return [];
22
- }
23
- const vulnerabilities = [];
24
- // Pattern: Math.random() used in security contexts
25
- const securityContextKeywords = [
26
- 'token',
27
- 'secret',
28
- 'password',
29
- 'salt',
30
- 'key',
31
- 'nonce',
32
- 'session',
33
- 'csrf',
34
- 'auth',
35
- 'crypto',
36
- ];
37
- const mathRandomPattern = /Math\.random\(\)/gi;
38
- let match;
39
- while ((match = mathRandomPattern.exec(content)) !== null) {
40
- if (this.shouldIgnore(content, match.index)) {
41
- continue;
42
- }
43
- // Check surrounding context (100 characters before and after)
44
- const contextStart = Math.max(0, match.index - 100);
45
- const contextEnd = Math.min(content.length, match.index + 100);
46
- const context = content.substring(contextStart, contextEnd).toLowerCase();
47
- // Check if in security-sensitive context
48
- const isSecurityContext = securityContextKeywords.some(keyword => context.includes(keyword));
49
- if (isSecurityContext) {
50
- const line = this.findLineNumber(content, match.index);
51
- const code = this.extractCodeSnippet(content, match.index, 1);
52
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Math.random() is not cryptographically secure and should not be used for security-sensitive operations', 'Use crypto.randomBytes() (Node.js) or crypto.getRandomValues() (browser) for cryptographic randomness', [
53
- 'https://owasp.org/www-community/vulnerabilities/Insecure_Randomness',
54
- 'https://nodejs.org/api/crypto.html#cryptorandombytessize-callback',
55
- ]));
56
- }
57
- }
58
- return vulnerabilities;
59
- }
60
- }
61
- //# sourceMappingURL=insecure-random-detector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insecure-random-detector.js","sourceRoot":"","sources":["../../../../src/analyzers/security/detectors/insecure-random-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,MAAM,OAAO,sBAAuB,SAAQ,oBAAoB;IAC9D;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,iBAAiB;YACrB,IAAI,EAAE,mCAAmC;YACzC,WAAW,EAAE,gEAAgE;YAC7E,QAAQ,EAAE,QAAQ;YAClB,aAAa,EAAE,mCAAmC;YAClD,KAAK,EAAE,SAAS;SACjB,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,KAAK,CAAC,CAAC;gBACvD,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;gBAE9D,eAAe,CAAC,IAAI,CAClB,IAAI,CAAC,mBAAmB,CACtB,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,wGAAwG,EACxG,uGAAuG,EACvG;oBACE,qEAAqE;oBACrE,mEAAmE;iBACpE,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Path Traversal Detector
3
- *
4
- * Detects potential path traversal vulnerabilities
5
- * OWASP A01:2021 - Broken Access Control
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- import type { SecurityVulnerability } from '../types.js';
9
- export declare class PathTraversalDetector extends BaseSecurityDetector {
10
- constructor();
11
- scan(content: string, filePath: string): Promise<SecurityVulnerability[]>;
12
- }
@@ -1,82 +0,0 @@
1
- /**
2
- * Path Traversal Detector
3
- *
4
- * Detects potential path traversal vulnerabilities
5
- * OWASP A01:2021 - Broken Access Control
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- export class PathTraversalDetector extends BaseSecurityDetector {
9
- constructor() {
10
- super({
11
- id: 'path-traversal',
12
- name: 'Path Traversal',
13
- description: 'Detects potential path traversal vulnerabilities',
14
- severity: 'high',
15
- owaspCategory: 'A01:2021 - Broken Access Control',
16
- cweId: 'CWE-22',
17
- });
18
- }
19
- async scan(content, filePath) {
20
- if (!this.appliesTo(filePath)) {
21
- return [];
22
- }
23
- const vulnerabilities = [];
24
- // Pattern 1: File operations with user input
25
- const fileOpPatterns = [
26
- {
27
- pattern: /(?:readFile|writeFile|unlink|stat|access|open)\([^)]*(?:req\.|params\.|query\.|input|user)/gi,
28
- operation: 'file operation',
29
- },
30
- {
31
- pattern: /(?:fs\.|promises\.)(?:readFile|writeFile|unlink|stat|access|open)\([^)]*(?:req\.|params\.|query\.|input|user)/gi,
32
- operation: 'file system operation',
33
- },
34
- {
35
- pattern: /path\.join\([^)]*(?:req\.|params\.|query\.|input|user)/gi,
36
- operation: 'path concatenation',
37
- },
38
- ];
39
- for (const { pattern, operation } of fileOpPatterns) {
40
- let match;
41
- const regex = new RegExp(pattern);
42
- while ((match = regex.exec(content)) !== null) {
43
- if (this.shouldIgnore(content, match.index)) {
44
- continue;
45
- }
46
- const line = this.findLineNumber(content, match.index);
47
- const code = this.extractCodeSnippet(content, match.index, 1);
48
- vulnerabilities.push(this.createVulnerability(filePath, line, code, `${operation} uses user input which may lead to path traversal attacks`, 'Validate and sanitize file paths. Use path.resolve() and check if resolved path is within allowed directory', [
49
- 'https://owasp.org/www-community/attacks/Path_Traversal',
50
- 'https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html',
51
- ]));
52
- }
53
- }
54
- // Pattern 2: Direct string concatenation for file paths
55
- const pathConcatPattern = /['"`][./\\]*['"`]\s*\+\s*(?:req\.|params\.|query\.|input|user)/gi;
56
- let match;
57
- while ((match = pathConcatPattern.exec(content)) !== null) {
58
- if (this.shouldIgnore(content, match.index)) {
59
- continue;
60
- }
61
- const line = this.findLineNumber(content, match.index);
62
- const code = this.extractCodeSnippet(content, match.index, 1);
63
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'File path constructed using string concatenation with user input', 'Never concatenate user input directly into file paths. Use path.join() with validation', [
64
- 'https://owasp.org/www-community/attacks/Path_Traversal',
65
- ]));
66
- }
67
- // Pattern 3: Template literals with user input in file paths
68
- const templatePathPattern = /(?:readFile|writeFile|unlink|stat|access|open)\([`'][^`']*\$\{(?:req\.|params\.|query\.|input|user)/gi;
69
- while ((match = templatePathPattern.exec(content)) !== null) {
70
- if (this.shouldIgnore(content, match.index)) {
71
- continue;
72
- }
73
- const line = this.findLineNumber(content, match.index);
74
- const code = this.extractCodeSnippet(content, match.index, 1);
75
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'File path uses template literal with user input', 'Validate and sanitize file paths. Ensure path stays within allowed directory', [
76
- 'https://owasp.org/www-community/attacks/Path_Traversal',
77
- ]));
78
- }
79
- return vulnerabilities;
80
- }
81
- }
82
- //# sourceMappingURL=path-traversal-detector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"path-traversal-detector.js","sourceRoot":"","sources":["../../../../src/analyzers/security/detectors/path-traversal-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,MAAM,OAAO,qBAAsB,SAAQ,oBAAoB;IAC7D;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,gBAAgB;YACpB,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,kDAAkD;YAC/D,QAAQ,EAAE,MAAM;YAChB,aAAa,EAAE,kCAAkC;YACjD,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAe,EAAE,QAAgB;QAC1C,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,eAAe,GAA4B,EAAE,CAAC;QAEpD,6CAA6C;QAC7C,MAAM,cAAc,GAAG;YACrB;gBACE,OAAO,EAAE,8FAA8F;gBACvG,SAAS,EAAE,gBAAgB;aAC5B;YACD;gBACE,OAAO,EAAE,iHAAiH;gBAC1H,SAAS,EAAE,uBAAuB;aACnC;YACD;gBACE,OAAO,EAAE,0DAA0D;gBACnE,SAAS,EAAE,oBAAoB;aAChC;SACF,CAAC;QAEF,KAAK,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,cAAc,EAAE,CAAC;YACpD,IAAI,KAAK,CAAC;YACV,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;YAClC,OAAO,CAAC,KA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CAAC;QACJ,CAAC;QAED,6DAA6D;QAC7D,MAAM,mBAAmB,GAAG,uGAAuG,CAAC;QACpI,OAAO,CAAC,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAC5D,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5C,SAAS;YACX,CAAC;YAED,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YACvD,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAE9D,eAAe,CAAC,IAAI,CAClB,IAAI,CAAC,mBAAmB,CACtB,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,iDAAiD,EACjD,8EAA8E,EAC9E;gBACE,wDAAwD;aACzD,CACF,CACF,CAAC;QACJ,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- /**
2
- * SQL Injection Detector
3
- *
4
- * Detects potential SQL injection vulnerabilities
5
- * OWASP A03:2021 - Injection
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- import type { SecurityVulnerability } from '../types.js';
9
- export declare class SQLInjectionDetector extends BaseSecurityDetector {
10
- constructor();
11
- scan(content: string, filePath: string): Promise<SecurityVulnerability[]>;
12
- }
@@ -1,88 +0,0 @@
1
- /**
2
- * SQL Injection Detector
3
- *
4
- * Detects potential SQL injection vulnerabilities
5
- * OWASP A03:2021 - Injection
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- export class SQLInjectionDetector extends BaseSecurityDetector {
9
- constructor() {
10
- super({
11
- id: 'sql-injection',
12
- name: 'SQL Injection',
13
- description: 'Detects potential SQL injection vulnerabilities',
14
- severity: 'critical',
15
- owaspCategory: 'A03:2021 - Injection',
16
- cweId: 'CWE-89',
17
- });
18
- }
19
- async scan(content, filePath) {
20
- if (!this.appliesTo(filePath)) {
21
- return [];
22
- }
23
- const vulnerabilities = [];
24
- // Pattern 1: String concatenation in SQL queries
25
- const concatPatterns = [
26
- /(?:query|sql|execute|exec)\s*(?:=|:)\s*['"`][\s\S]*?\$\{[^}]+\}/gi,
27
- /(?:query|sql|execute|exec)\s*(?:=|:)\s*['"`][\s\S]*?\+\s*\w+/gi,
28
- /(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE)[\s\S]*?\+\s*\w+/gi,
29
- ];
30
- for (const pattern of concatPatterns) {
31
- let match;
32
- const regex = new RegExp(pattern);
33
- while ((match = regex.exec(content)) !== null) {
34
- if (this.shouldIgnore(content, match.index)) {
35
- continue;
36
- }
37
- const line = this.findLineNumber(content, match.index);
38
- const code = this.extractCodeSnippet(content, match.index, 1);
39
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'SQL query uses string concatenation which may lead to SQL injection', 'Use parameterized queries or prepared statements instead of string concatenation', [
40
- 'https://owasp.org/www-community/attacks/SQL_Injection',
41
- 'https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html',
42
- ]));
43
- }
44
- }
45
- // Pattern 2: Direct use of user input in queries
46
- const userInputPatterns = [
47
- /(?:query|sql|execute|exec)\s*(?:=|:)\s*['"`][\s\S]*?(?:req\.body|req\.query|req\.params|params|input|userInput)/gi,
48
- /(?:SELECT|INSERT|UPDATE|DELETE)[\s\S]{0,100}(?:req\.body|req\.query|req\.params|params|input)/gi,
49
- ];
50
- for (const pattern of userInputPatterns) {
51
- let match;
52
- const regex = new RegExp(pattern);
53
- while ((match = regex.exec(content)) !== null) {
54
- if (this.shouldIgnore(content, match.index)) {
55
- continue;
56
- }
57
- const line = this.findLineNumber(content, match.index);
58
- const code = this.extractCodeSnippet(content, match.index, 1);
59
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'SQL query directly uses user input without sanitization', 'Always sanitize and validate user input. Use parameterized queries or ORM methods', [
60
- 'https://owasp.org/www-community/attacks/SQL_Injection',
61
- 'https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html',
62
- ]));
63
- }
64
- }
65
- // Pattern 3: Unsafe query execution methods
66
- const unsafeMethodPatterns = [
67
- /\.query\(['"`][^'"`]*\$\{/gi,
68
- /\.exec\(['"`][^'"`]*\$\{/gi,
69
- /\.raw\(['"`][^'"`]*\$\{/gi,
70
- ];
71
- for (const pattern of unsafeMethodPatterns) {
72
- let match;
73
- const regex = new RegExp(pattern);
74
- while ((match = regex.exec(content)) !== null) {
75
- if (this.shouldIgnore(content, match.index)) {
76
- continue;
77
- }
78
- const line = this.findLineNumber(content, match.index);
79
- const code = this.extractCodeSnippet(content, match.index, 1);
80
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Database method uses template literals which may be vulnerable to SQL injection', 'Use parameterized queries with placeholders (?, $1, etc.) instead of template literals', [
81
- 'https://owasp.org/www-community/attacks/SQL_Injection',
82
- ]));
83
- }
84
- }
85
- return vulnerabilities;
86
- }
87
- }
88
- //# sourceMappingURL=sql-injection-detector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sql-injection-detector.js","sourceRoot":"","sources":["../../../../src/analyzers/security/detectors/sql-injection-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,MAAM,OAAO,oBAAqB,SAAQ,oBAAoB;IAC5D;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,eAAe;YACnB,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,UAAU;YACpB,aAAa,EAAE,sBAAsB;YACrC,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAe,EAAE,QAAgB;QAC1C,IAAI,C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,mBAAmB,CACtB,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,iFAAiF,EACjF,wFAAwF,EACxF;oBACE,uDAAuD;iBACxD,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Weak Cryptography Detector
3
- *
4
- * Detects use of weak or deprecated cryptographic algorithms
5
- * OWASP A02:2021 - Cryptographic Failures
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- import type { SecurityVulnerability } from '../types.js';
9
- export declare class WeakCryptoDetector extends BaseSecurityDetector {
10
- constructor();
11
- scan(content: string, filePath: string): Promise<SecurityVulnerability[]>;
12
- }
@@ -1,104 +0,0 @@
1
- /**
2
- * Weak Cryptography Detector
3
- *
4
- * Detects use of weak or deprecated cryptographic algorithms
5
- * OWASP A02:2021 - Cryptographic Failures
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- export class WeakCryptoDetector extends BaseSecurityDetector {
9
- constructor() {
10
- super({
11
- id: 'weak-cryptography',
12
- name: 'Weak Cryptography',
13
- description: 'Detects use of weak or deprecated cryptographic algorithms',
14
- severity: 'high',
15
- owaspCategory: 'A02:2021 - Cryptographic Failures',
16
- cweId: 'CWE-327',
17
- });
18
- }
19
- async scan(content, filePath) {
20
- if (!this.appliesTo(filePath)) {
21
- return [];
22
- }
23
- const vulnerabilities = [];
24
- // Pattern 1: Weak hashing algorithms
25
- const weakHashAlgorithms = ['md5', 'sha1', 'md4', 'md2'];
26
- for (const algorithm of weakHashAlgorithms) {
27
- const pattern = new RegExp(`createHash\\(['"\`]${algorithm}['"\`]\\)`, 'gi');
28
- let match;
29
- while ((match = pattern.exec(content)) !== null) {
30
- if (this.shouldIgnore(content, match.index)) {
31
- continue;
32
- }
33
- const line = this.findLineNumber(content, match.index);
34
- const code = this.extractCodeSnippet(content, match.index, 1);
35
- vulnerabilities.push(this.createVulnerability(filePath, line, code, `Weak hashing algorithm ${algorithm.toUpperCase()} detected`, `Use SHA-256, SHA-384, or SHA-512 instead of ${algorithm.toUpperCase()}`, [
36
- 'https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/09-Testing_for_Weak_Cryptography/',
37
- 'https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html',
38
- ]));
39
- }
40
- }
41
- // Pattern 2: Weak cipher algorithms
42
- const weakCipherAlgorithms = ['des', 'des-ede', 'des-ede-cbc', 'des3', 'rc4', 'rc2', 'blowfish'];
43
- for (const algorithm of weakCipherAlgorithms) {
44
- const pattern = new RegExp(`createCipher(?:iv)?\\(['"\`]${algorithm}['"\`]`, 'gi');
45
- let match;
46
- while ((match = pattern.exec(content)) !== null) {
47
- if (this.shouldIgnore(content, match.index)) {
48
- continue;
49
- }
50
- const line = this.findLineNumber(content, match.index);
51
- const code = this.extractCodeSnippet(content, match.index, 1);
52
- vulnerabilities.push(this.createVulnerability(filePath, line, code, `Weak cipher algorithm ${algorithm.toUpperCase()} detected`, 'Use AES-256-GCM or ChaCha20-Poly1305 for encryption', [
53
- 'https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/09-Testing_for_Weak_Cryptography/',
54
- ]));
55
- }
56
- }
57
- // Pattern 3: ECB mode (insecure block cipher mode)
58
- const ecbPattern = /createCipher(?:iv)?\(['"`][^'"`]*-ecb['"`]/gi;
59
- let match;
60
- while ((match = ecbPattern.exec(content)) !== null) {
61
- if (this.shouldIgnore(content, match.index)) {
62
- continue;
63
- }
64
- const line = this.findLineNumber(content, match.index);
65
- const code = this.extractCodeSnippet(content, match.index, 1);
66
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'ECB mode is insecure and should not be used', 'Use GCM or CBC mode with proper IV instead of ECB', [
67
- 'https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/09-Testing_for_Weak_Cryptography/',
68
- ]));
69
- }
70
- // Pattern 4: Deprecated createCipher (should use createCipheriv)
71
- const createCipherPattern = /createCipher\(/g;
72
- while ((match = createCipherPattern.exec(content)) !== null) {
73
- if (this.shouldIgnore(content, match.index)) {
74
- continue;
75
- }
76
- // Check if it's not createCipheriv
77
- const afterMatch = content.substring(match.index, match.index + 20);
78
- if (!afterMatch.includes('createCipheriv')) {
79
- const line = this.findLineNumber(content, match.index);
80
- const code = this.extractCodeSnippet(content, match.index, 1);
81
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'createCipher is deprecated and insecure', 'Use createCipheriv with a random IV instead', [
82
- 'https://nodejs.org/api/crypto.html#cryptocreatecipherivalgorithm-key-iv-options',
83
- ]));
84
- }
85
- }
86
- // Pattern 5: Small RSA key sizes
87
- const rsaKeyPattern = /(?:modulusLength|keySize)['"\s:]*(\d+)/gi;
88
- while ((match = rsaKeyPattern.exec(content)) !== null) {
89
- if (this.shouldIgnore(content, match.index)) {
90
- continue;
91
- }
92
- const keySize = parseInt(match[1], 10);
93
- if (keySize < 2048) {
94
- const line = this.findLineNumber(content, match.index);
95
- const code = this.extractCodeSnippet(content, match.index, 1);
96
- vulnerabilities.push(this.createVulnerability(filePath, line, code, `RSA key size of ${keySize} bits is too small`, 'Use at least 2048 bits for RSA keys, preferably 4096 bits', [
97
- 'https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html',
98
- ]));
99
- }
100
- }
101
- return vulnerabilities;
102
- }
103
- }
104
- //# sourceMappingURL=weak-crypto-detector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"weak-crypto-detector.js","sourceRoot":"","sources":["../../../../src/analyzers/security/detectors/weak-crypto-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,MAAM,OAAO,kBAAmB,SAAQ,oBAAoB;IAC1D;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,mBAAmB;YACvB,IAAI,EAAE,mBAAmB;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AAG,0CAA0C,CAAC;QACjE,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACtD,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5C,SAAS;YACX,CAAC;YAED,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,IAAI,OAAO,GAAG,IAAI,EAAE,CAAC;gBACnB,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;gBACvD,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;gBAE9D,eAAe,CAAC,IAAI,CAClB,IAAI,CAAC,mBAAmB,CACtB,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,mBAAmB,OAAO,oBAAoB,EAC9C,2DAA2D,EAC3D;oBACE,uFAAuF;iBACxF,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- /**
2
- * XSS (Cross-Site Scripting) Detector
3
- *
4
- * Detects potential XSS vulnerabilities
5
- * OWASP A03:2021 - Injection
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- import type { SecurityVulnerability } from '../types.js';
9
- export declare class XSSDetector extends BaseSecurityDetector {
10
- constructor();
11
- scan(content: string, filePath: string): Promise<SecurityVulnerability[]>;
12
- }
@@ -1,90 +0,0 @@
1
- /**
2
- * XSS (Cross-Site Scripting) Detector
3
- *
4
- * Detects potential XSS vulnerabilities
5
- * OWASP A03:2021 - Injection
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- export class XSSDetector extends BaseSecurityDetector {
9
- constructor() {
10
- super({
11
- id: 'xss-vulnerability',
12
- name: 'Cross-Site Scripting (XSS)',
13
- description: 'Detects potential XSS vulnerabilities',
14
- severity: 'high',
15
- owaspCategory: 'A03:2021 - Injection',
16
- cweId: 'CWE-79',
17
- });
18
- }
19
- async scan(content, filePath) {
20
- if (!this.appliesTo(filePath)) {
21
- return [];
22
- }
23
- const vulnerabilities = [];
24
- // Pattern 1: dangerouslySetInnerHTML in React
25
- const dangerouslySetInnerHTMLPattern = /dangerouslySetInnerHTML\s*=\s*\{\{?\s*__html:\s*(?!['"`])[^}]+\}\}?/gi;
26
- let match;
27
- while ((match = dangerouslySetInnerHTMLPattern.exec(content)) !== null) {
28
- if (this.shouldIgnore(content, match.index)) {
29
- continue;
30
- }
31
- const line = this.findLineNumber(content, match.index);
32
- const code = this.extractCodeSnippet(content, match.index, 1);
33
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Using dangerouslySetInnerHTML with unsanitized content may lead to XSS', 'Sanitize HTML content using a library like DOMPurify before rendering', [
34
- 'https://owasp.org/www-community/attacks/xss/',
35
- 'https://react.dev/reference/react-dom/components/common#dangerously-setting-the-inner-html',
36
- ]));
37
- }
38
- // Pattern 2: innerHTML assignment
39
- const innerHTMLPattern = /\.innerHTML\s*=\s*(?!['"`])[^;]+/gi;
40
- while ((match = innerHTMLPattern.exec(content)) !== null) {
41
- if (this.shouldIgnore(content, match.index)) {
42
- continue;
43
- }
44
- const line = this.findLineNumber(content, match.index);
45
- const code = this.extractCodeSnippet(content, match.index, 1);
46
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Direct innerHTML assignment with dynamic content may lead to XSS', 'Use textContent for text or sanitize HTML before assignment', [
47
- 'https://owasp.org/www-community/attacks/xss/',
48
- 'https://cheatsheetseries.owasp.org/cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html',
49
- ]));
50
- }
51
- // Pattern 3: document.write with user input
52
- const documentWritePattern = /document\.write\([^)]*(?:req\.|params\.|input|user|query)/gi;
53
- while ((match = documentWritePattern.exec(content)) !== null) {
54
- if (this.shouldIgnore(content, match.index)) {
55
- continue;
56
- }
57
- const line = this.findLineNumber(content, match.index);
58
- const code = this.extractCodeSnippet(content, match.index, 1);
59
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'document.write with user input may lead to XSS', 'Avoid document.write. Use DOM manipulation methods and sanitize input', [
60
- 'https://owasp.org/www-community/attacks/xss/',
61
- ]));
62
- }
63
- // Pattern 4: eval() with user input
64
- const evalPattern = /eval\([^)]*(?:req\.|params\.|input|user|query)/gi;
65
- while ((match = evalPattern.exec(content)) !== null) {
66
- if (this.shouldIgnore(content, match.index)) {
67
- continue;
68
- }
69
- const line = this.findLineNumber(content, match.index);
70
- const code = this.extractCodeSnippet(content, match.index, 1);
71
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'eval() with user input is extremely dangerous and may lead to code injection', 'Never use eval() with user input. Find alternative solutions', [
72
- 'https://owasp.org/www-community/attacks/Code_Injection',
73
- ]));
74
- }
75
- // Pattern 5: Unescaped template rendering (Express, etc.)
76
- const unescapedRenderPattern = /res\.send\([^)]*\$\{(?:req\.|params\.|input|user|query)/gi;
77
- while ((match = unescapedRenderPattern.exec(content)) !== null) {
78
- if (this.shouldIgnore(content, match.index)) {
79
- continue;
80
- }
81
- const line = this.findLineNumber(content, match.index);
82
- const code = this.extractCodeSnippet(content, match.index, 1);
83
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Sending unescaped user input in response may lead to XSS', 'Escape HTML entities or use a templating engine with auto-escaping', [
84
- 'https://owasp.org/www-community/attacks/xss/',
85
- ]));
86
- }
87
- return vulnerabilities;
88
- }
89
- }
90
- //# sourceMappingURL=xss-detector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"xss-detector.js","sourceRoot":"","sources":["../../../../src/analyzers/security/detectors/xss-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,C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@ -1,16 +0,0 @@
1
- /**
2
- * Security Analyzer Module
3
- *
4
- * Provides security vulnerability detection with OWASP-aligned detectors
5
- */
6
- export { SecurityAnalyzer } from './security-analyzer.js';
7
- export { BaseSecurityDetector } from './base-detector.js';
8
- export * from './types.js';
9
- export { SQLInjectionDetector } from './detectors/sql-injection-detector.js';
10
- export { XSSDetector } from './detectors/xss-detector.js';
11
- export { HardcodedSecretsDetector } from './detectors/hardcoded-secrets-detector.js';
12
- export { InsecureRandomDetector } from './detectors/insecure-random-detector.js';
13
- export { PathTraversalDetector } from './detectors/path-traversal-detector.js';
14
- export { CommandInjectionDetector } from './detectors/command-injection-detector.js';
15
- export { WeakCryptoDetector } from './detectors/weak-crypto-detector.js';
16
- export { InsecureDeserializationDetector } from './detectors/insecure-deserialization-detector.js';
@@ -1,18 +0,0 @@
1
- /**
2
- * Security Analyzer Module
3
- *
4
- * Provides security vulnerability detection with OWASP-aligned detectors
5
- */
6
- export { SecurityAnalyzer } from './security-analyzer.js';
7
- export { BaseSecurityDetector } from './base-detector.js';
8
- export * from './types.js';
9
- // Export all detectors
10
- export { SQLInjectionDetector } from './detectors/sql-injection-detector.js';
11
- export { XSSDetector } from './detectors/xss-detector.js';
12
- export { HardcodedSecretsDetector } from './detectors/hardcoded-secrets-detector.js';
13
- export { InsecureRandomDetector } from './detectors/insecure-random-detector.js';
14
- export { PathTraversalDetector } from './detectors/path-traversal-detector.js';
15
- export { CommandInjectionDetector } from './detectors/command-injection-detector.js';
16
- export { WeakCryptoDetector } from './detectors/weak-crypto-detector.js';
17
- export { InsecureDeserializationDetector } from './detectors/insecure-deserialization-detector.js';
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/analyzers/security/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,cAAc,YAAY,CAAC;AAE3B,uBAAuB;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,kDAAkD,CAAC"}
@@ -1,38 +0,0 @@
1
- /**
2
- * Security Analyzer
3
- *
4
- * Main orchestrator for security vulnerability detection
5
- */
6
- import type { SecurityDetector, FileSecurityResult, BatchSecurityResult, SecurityScanOptions } from './types.js';
7
- export declare class SecurityAnalyzer {
8
- private detectors;
9
- constructor();
10
- /**
11
- * Register all default security detectors
12
- */
13
- private registerDefaultDetectors;
14
- /**
15
- * Scan a single file for security vulnerabilities
16
- */
17
- scanFile(filePath: string, options?: SecurityScanOptions): Promise<FileSecurityResult>;
18
- /**
19
- * Scan multiple files in batch
20
- */
21
- scanBatch(files: string[], options?: SecurityScanOptions): Promise<BatchSecurityResult>;
22
- /**
23
- * Scan directory with pattern
24
- */
25
- scanDirectory(directory: string, pattern?: string, options?: SecurityScanOptions): Promise<BatchSecurityResult>;
26
- /**
27
- * Calculate risk score for a file based on vulnerabilities
28
- */
29
- private calculateRiskScore;
30
- /**
31
- * Get list of all registered detectors
32
- */
33
- getDetectors(): SecurityDetector[];
34
- /**
35
- * Get detector by ID
36
- */
37
- getDetector(id: string): SecurityDetector | undefined;
38
- }