@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,58 +0,0 @@
1
- /**
2
- * Base Security Detector
3
- *
4
- * Abstract base class for security vulnerability detectors
5
- */
6
- import type { SecurityDetector, SecurityVulnerability, SecuritySeverity, OWASPCategory } from './types.js';
7
- export declare abstract class BaseSecurityDetector implements SecurityDetector {
8
- readonly id: string;
9
- readonly name: string;
10
- readonly description: string;
11
- readonly severity: SecuritySeverity;
12
- readonly owaspCategory?: OWASPCategory;
13
- readonly cweId?: string;
14
- readonly enabled: boolean;
15
- protected readonly fileExtensions: readonly string[];
16
- constructor(config: {
17
- id: string;
18
- name: string;
19
- description: string;
20
- severity: SecuritySeverity;
21
- owaspCategory?: OWASPCategory;
22
- cweId?: string;
23
- fileExtensions?: readonly string[];
24
- enabled?: boolean;
25
- });
26
- /**
27
- * Check if detector applies to this file type
28
- */
29
- appliesTo(filePath: string): boolean;
30
- /**
31
- * Scan file content for vulnerabilities
32
- */
33
- abstract scan(content: string, filePath: string): Promise<SecurityVulnerability[]>;
34
- /**
35
- * Create a vulnerability finding
36
- */
37
- protected createVulnerability(file: string, line: number, code: string, description: string, recommendation: string, references?: string[]): SecurityVulnerability;
38
- /**
39
- * Find line number for a match in content
40
- */
41
- protected findLineNumber(content: string, matchIndex: number): number;
42
- /**
43
- * Extract code snippet around a match
44
- */
45
- protected extractCodeSnippet(content: string, matchIndex: number, contextLines?: number): string;
46
- /**
47
- * Check if line is in a comment
48
- */
49
- protected isInComment(content: string, matchIndex: number): boolean;
50
- /**
51
- * Check if match is in a string literal
52
- */
53
- protected isInString(content: string, matchIndex: number): boolean;
54
- /**
55
- * Check if match should be ignored
56
- */
57
- protected shouldIgnore(content: string, matchIndex: number): boolean;
58
- }
@@ -1,104 +0,0 @@
1
- /**
2
- * Base Security Detector
3
- *
4
- * Abstract base class for security vulnerability detectors
5
- */
6
- import path from 'path';
7
- export class BaseSecurityDetector {
8
- id;
9
- name;
10
- description;
11
- severity;
12
- owaspCategory;
13
- cweId;
14
- enabled;
15
- fileExtensions;
16
- constructor(config) {
17
- this.id = config.id;
18
- this.name = config.name;
19
- this.description = config.description;
20
- this.severity = config.severity;
21
- this.owaspCategory = config.owaspCategory;
22
- this.cweId = config.cweId;
23
- this.fileExtensions = config.fileExtensions || ['.ts', '.tsx', '.js', '.jsx'];
24
- this.enabled = config.enabled !== false;
25
- }
26
- /**
27
- * Check if detector applies to this file type
28
- */
29
- appliesTo(filePath) {
30
- const ext = path.extname(filePath).toLowerCase();
31
- return this.fileExtensions.includes(ext);
32
- }
33
- /**
34
- * Create a vulnerability finding
35
- */
36
- createVulnerability(file, line, code, description, recommendation, references = []) {
37
- return Object.freeze({
38
- id: this.id,
39
- name: this.name,
40
- description,
41
- severity: this.severity,
42
- owaspCategory: this.owaspCategory,
43
- cweId: this.cweId,
44
- file,
45
- line,
46
- code: code.trim(),
47
- recommendation,
48
- references: Object.freeze(references),
49
- });
50
- }
51
- /**
52
- * Find line number for a match in content
53
- */
54
- findLineNumber(content, matchIndex) {
55
- const beforeMatch = content.substring(0, matchIndex);
56
- return beforeMatch.split('\n').length;
57
- }
58
- /**
59
- * Extract code snippet around a match
60
- */
61
- extractCodeSnippet(content, matchIndex, contextLines = 0) {
62
- const lines = content.split('\n');
63
- const lineNumber = this.findLineNumber(content, matchIndex);
64
- const startLine = Math.max(0, lineNumber - contextLines - 1);
65
- const endLine = Math.min(lines.length, lineNumber + contextLines);
66
- return lines.slice(startLine, endLine).join('\n');
67
- }
68
- /**
69
- * Check if line is in a comment
70
- */
71
- isInComment(content, matchIndex) {
72
- const beforeMatch = content.substring(0, matchIndex);
73
- const lastLineBreak = beforeMatch.lastIndexOf('\n');
74
- const currentLine = content.substring(lastLineBreak + 1, matchIndex + 50);
75
- // Check for single-line comment
76
- if (currentLine.includes('//')) {
77
- return true;
78
- }
79
- // Check for multi-line comment
80
- const openComments = (beforeMatch.match(/\/\*/g) || []).length;
81
- const closeComments = (beforeMatch.match(/\*\//g) || []).length;
82
- return openComments > closeComments;
83
- }
84
- /**
85
- * Check if match is in a string literal
86
- */
87
- isInString(content, matchIndex) {
88
- const beforeMatch = content.substring(0, matchIndex);
89
- const lastLineBreak = beforeMatch.lastIndexOf('\n');
90
- const lineContent = beforeMatch.substring(lastLineBreak + 1);
91
- // Count unescaped quotes
92
- const singleQuotes = (lineContent.match(/(?<!\\)'/g) || []).length;
93
- const doubleQuotes = (lineContent.match(/(?<!\\)"/g) || []).length;
94
- const backticks = (lineContent.match(/(?<!\\)`/g) || []).length;
95
- return (singleQuotes % 2 === 1) || (doubleQuotes % 2 === 1) || (backticks % 2 === 1);
96
- }
97
- /**
98
- * Check if match should be ignored
99
- */
100
- shouldIgnore(content, matchIndex) {
101
- return this.isInComment(content, matchIndex) || this.isInString(content, matchIndex);
102
- }
103
- }
104
- //# sourceMappingURL=base-detector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-detector.js","sourceRoot":"","sources":["../../../src/analyzers/security/base-detector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,OAAgB,oBAAoB;IACxB,EAAE,CAAS;IACX,IAAI,CAAS;IACb,WAAW,CAAS;IACpB,QAAQ,CAAmB;IAC3B,aAAa,CAAiB;IAC9B,KAAK,CAAU;IACf,OAAO,CAAU;IAEd,cAAc,CAAoB;IAErD,YAAY,MASX;QACC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAC9E,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,QAAgB;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IAOD;;OAEG;IACO,mBAAmB,CAC3B,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,WAAmB,EACnB,cAAsB,EACtB,aAAuB,EAAE;QAEzB,OAAO,MAAM,CA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CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACvF,CAAC;IAED;;OAEG;IACO,YAAY,CAAC,OAAe,EAAE,UAAkB;QACxD,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACvF,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Command Injection Detector
3
- *
4
- * Detects potential command 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 CommandInjectionDetector extends BaseSecurityDetector {
10
- constructor();
11
- scan(content: string, filePath: string): Promise<SecurityVulnerability[]>;
12
- }
@@ -1,84 +0,0 @@
1
- /**
2
- * Command Injection Detector
3
- *
4
- * Detects potential command injection vulnerabilities
5
- * OWASP A03:2021 - Injection
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- export class CommandInjectionDetector extends BaseSecurityDetector {
9
- constructor() {
10
- super({
11
- id: 'command-injection',
12
- name: 'Command Injection',
13
- description: 'Detects potential command injection vulnerabilities',
14
- severity: 'critical',
15
- owaspCategory: 'A03:2021 - Injection',
16
- cweId: 'CWE-78',
17
- });
18
- }
19
- async scan(content, filePath) {
20
- if (!this.appliesTo(filePath)) {
21
- return [];
22
- }
23
- const vulnerabilities = [];
24
- // Pattern 1: exec/execSync with user input
25
- const execPatterns = [
26
- {
27
- pattern: /(?:exec|execSync|spawn|spawnSync)\([^)]*(?:req\.|params\.|query\.|input|user)/gi,
28
- method: 'child_process method',
29
- },
30
- {
31
- pattern: /(?:exec|execSync|spawn|spawnSync)\([`'][^`']*\$\{(?:req\.|params\.|query\.|input|user)/gi,
32
- method: 'child_process method with template literal',
33
- },
34
- ];
35
- for (const { pattern, method } of execPatterns) {
36
- let match;
37
- const regex = new RegExp(pattern);
38
- while ((match = regex.exec(content)) !== null) {
39
- if (this.shouldIgnore(content, match.index)) {
40
- continue;
41
- }
42
- const line = this.findLineNumber(content, match.index);
43
- const code = this.extractCodeSnippet(content, match.index, 1);
44
- vulnerabilities.push(this.createVulnerability(filePath, line, code, `${method} uses user input which may lead to command injection`, 'Never pass user input directly to shell commands. Use execFile with array arguments or validate/sanitize input strictly', [
45
- 'https://owasp.org/www-community/attacks/Command_Injection',
46
- 'https://cheatsheetseries.owasp.org/cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html',
47
- ]));
48
- }
49
- }
50
- // Pattern 2: Shell: true option with user input
51
- const shellTruePattern = /(?:exec|spawn)\([^,)]*,\s*\{[^}]*shell:\s*true[^}]*\}/gi;
52
- let match;
53
- while ((match = shellTruePattern.exec(content)) !== null) {
54
- if (this.shouldIgnore(content, match.index)) {
55
- continue;
56
- }
57
- // Check if user input is nearby
58
- const contextStart = Math.max(0, match.index - 100);
59
- const contextEnd = Math.min(content.length, match.index + 200);
60
- const context = content.substring(contextStart, contextEnd);
61
- if (/(?:req\.|params\.|query\.|input|user)/.test(context)) {
62
- const line = this.findLineNumber(content, match.index);
63
- const code = this.extractCodeSnippet(content, match.index, 1);
64
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Using shell: true with user input is extremely dangerous', 'Avoid shell: true. Use execFile or spawn with array arguments', [
65
- 'https://owasp.org/www-community/attacks/Command_Injection',
66
- ]));
67
- }
68
- }
69
- // Pattern 3: String concatenation in commands
70
- const commandConcatPattern = /(?:exec|execSync)\(['"`][^'"`]*\+\s*(?:req\.|params\.|query\.|input|user)/gi;
71
- while ((match = commandConcatPattern.exec(content)) !== null) {
72
- if (this.shouldIgnore(content, match.index)) {
73
- continue;
74
- }
75
- const line = this.findLineNumber(content, match.index);
76
- const code = this.extractCodeSnippet(content, match.index, 1);
77
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Command constructed using string concatenation with user input', 'Use execFile with array arguments to avoid command injection', [
78
- 'https://owasp.org/www-community/attacks/Command_Injection',
79
- ]));
80
- }
81
- return vulnerabilities;
82
- }
83
- }
84
- //# sourceMappingURL=command-injection-detector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-injection-detector.js","sourceRoot":"","sources":["../../../../src/analyzers/security/detectors/command-injection-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,MAAM,OAAO,wBAAyB,SAAQ,oBAAoB;IAChE;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,mBAAmB;YACvB,IAAI,EAAE,mBAAmB;YACzB,WAAW,EAAE,qDAAqD;YAClE,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,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,eAAe,GAA4B,EAAE,CAAC;QAEpD,2CAA2C;QAC3C,MAAM,YAAY,GAAG;YACnB;gBACE,OAAO,EAAE,iFAAiF;gBAC1F,MAAM,EAAE,sBAAsB;aAC/B;YACD;gBACE,OAAO,EAAE,0FAA0F;gBACnG,MAAM,EAAE,4CAA4C;aACrD;SACF,CAAC;QAEF,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,YAAY,EAAE,CAAC;YAC/C,IAAI,KAAK,CAAC;YACV,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;YAClC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;gBAC9C,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,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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,0DAA0D,EAC1D,+DAA+D,EAC/D;oBACE,2DAA2D;iBAC5D,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,8CAA8C;QAC9C,MAAM,oBAAoB,GAAG,6EAA6E,CAAC;QAC3G,OAAO,CAAC,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAC7D,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,gEAAgE,EAChE,8DAA8D,EAC9D;gBACE,2DAA2D;aAC5D,CACF,CACF,CAAC;QACJ,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Hardcoded Secrets Detector
3
- *
4
- * Detects hardcoded passwords, API keys, tokens, and other secrets
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 HardcodedSecretsDetector extends BaseSecurityDetector {
10
- constructor();
11
- scan(content: string, filePath: string): Promise<SecurityVulnerability[]>;
12
- /**
13
- * Check if value looks like a placeholder
14
- */
15
- private isPlaceholder;
16
- }
@@ -1,140 +0,0 @@
1
- /**
2
- * Hardcoded Secrets Detector
3
- *
4
- * Detects hardcoded passwords, API keys, tokens, and other secrets
5
- * OWASP A02:2021 - Cryptographic Failures
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- export class HardcodedSecretsDetector extends BaseSecurityDetector {
9
- constructor() {
10
- super({
11
- id: 'hardcoded-secrets',
12
- name: 'Hardcoded Secrets',
13
- description: 'Detects hardcoded passwords, API keys, and tokens',
14
- severity: 'critical',
15
- owaspCategory: 'A02:2021 - Cryptographic Failures',
16
- cweId: 'CWE-798',
17
- });
18
- }
19
- async scan(content, filePath) {
20
- if (!this.appliesTo(filePath)) {
21
- return [];
22
- }
23
- const vulnerabilities = [];
24
- // Pattern 1: Common secret variable names with hardcoded values
25
- const secretVarPatterns = [
26
- {
27
- pattern: /(?:password|passwd|pwd|secret|token|apikey|api_key|private_key|privatekey)\s*[:=]\s*['"`]([^'"`]{8,})['"`]/gi,
28
- type: 'password/token',
29
- },
30
- {
31
- pattern: /(?:auth|authorization|bearer)\s*[:=]\s*['"`]([^'"`]{20,})['"`]/gi,
32
- type: 'auth token',
33
- },
34
- {
35
- pattern: /(?:access_token|accesstoken|refresh_token|refreshtoken)\s*[:=]\s*['"`]([^'"`]{20,})['"`]/gi,
36
- type: 'access token',
37
- },
38
- ];
39
- for (const { pattern, type } of secretVarPatterns) {
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
- // Skip if it looks like a placeholder
47
- const value = match[1];
48
- if (this.isPlaceholder(value)) {
49
- continue;
50
- }
51
- const line = this.findLineNumber(content, match.index);
52
- const code = this.extractCodeSnippet(content, match.index, 0);
53
- vulnerabilities.push(this.createVulnerability(filePath, line, code, `Hardcoded ${type} detected in source code`, 'Use environment variables or secure secret management systems (e.g., AWS Secrets Manager, HashiCorp Vault)', [
54
- 'https://owasp.org/www-community/vulnerabilities/Use_of_hard-coded_password',
55
- 'https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html',
56
- ]));
57
- }
58
- }
59
- // Pattern 2: AWS Access Keys
60
- const awsKeyPattern = /(?:AKIA|A3T|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}/g;
61
- let match;
62
- while ((match = awsKeyPattern.exec(content)) !== null) {
63
- if (this.shouldIgnore(content, match.index)) {
64
- continue;
65
- }
66
- const line = this.findLineNumber(content, match.index);
67
- const code = this.extractCodeSnippet(content, match.index, 0);
68
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'AWS Access Key ID detected in source code', 'Remove hardcoded AWS credentials. Use IAM roles or environment variables', [
69
- 'https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html',
70
- ]));
71
- }
72
- // Pattern 3: Generic API key patterns
73
- const apiKeyPattern = /['"`]([a-zA-Z0-9_-]{32,})['"`]/g;
74
- while ((match = apiKeyPattern.exec(content)) !== null) {
75
- if (this.shouldIgnore(content, match.index)) {
76
- continue;
77
- }
78
- // Check if preceded by key-related variable names
79
- const beforeMatch = content.substring(Math.max(0, match.index - 50), match.index);
80
- if (/(?:key|token|secret|api)/i.test(beforeMatch)) {
81
- const value = match[1];
82
- if (this.isPlaceholder(value)) {
83
- continue;
84
- }
85
- const line = this.findLineNumber(content, match.index);
86
- const code = this.extractCodeSnippet(content, match.index, 0);
87
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Potential API key or token detected in source code', 'Use environment variables to store sensitive credentials', [
88
- 'https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html',
89
- ]));
90
- }
91
- }
92
- // Pattern 4: JWT tokens
93
- const jwtPattern = /eyJ[a-zA-Z0-9_-]+\.eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/g;
94
- while ((match = jwtPattern.exec(content)) !== null) {
95
- if (this.shouldIgnore(content, match.index)) {
96
- continue;
97
- }
98
- const line = this.findLineNumber(content, match.index);
99
- const code = this.extractCodeSnippet(content, match.index, 0);
100
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'JWT token detected in source code', 'Never hardcode JWT tokens. Generate them at runtime', [
101
- 'https://jwt.io/introduction',
102
- ]));
103
- }
104
- // Pattern 5: Database connection strings
105
- const dbConnectionPattern = /(?:mongodb|mysql|postgresql|postgres|redis):\/\/[^\s;'"]+:[^\s;'"]+@/gi;
106
- while ((match = dbConnectionPattern.exec(content)) !== null) {
107
- if (this.shouldIgnore(content, match.index)) {
108
- continue;
109
- }
110
- const line = this.findLineNumber(content, match.index);
111
- const code = this.extractCodeSnippet(content, match.index, 0);
112
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Database connection string with credentials detected in source code', 'Use environment variables for database credentials', [
113
- 'https://cheatsheetseries.owasp.org/cheatsheets/Database_Security_Cheat_Sheet.html',
114
- ]));
115
- }
116
- return vulnerabilities;
117
- }
118
- /**
119
- * Check if value looks like a placeholder
120
- */
121
- isPlaceholder(value) {
122
- const placeholders = [
123
- /^[xX]+$/,
124
- /^[*]+$/,
125
- /^your[_-]?/i,
126
- /^test[_-]?/i,
127
- /^example/i,
128
- /^placeholder/i,
129
- /^dummy/i,
130
- /^fake/i,
131
- /^sample/i,
132
- /^xxx/i,
133
- /^todo/i,
134
- /^changeme/i,
135
- /^replace/i,
136
- ];
137
- return placeholders.some(pattern => pattern.test(value));
138
- }
139
- }
140
- //# sourceMappingURL=hardcoded-secrets-detector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hardcoded-secrets-detector.js","sourceRoot":"","sources":["../../../../src/analyzers/security/detectors/hardcoded-secrets-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,MAAM,OAAO,wBAAyB,SAAQ,oBAAoB;IAChE;QACE,KAAK,CAA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erabilities
5
- * OWASP A08:2021 - Software and Data Integrity Failures
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- import type { SecurityVulnerability } from '../types.js';
9
- export declare class InsecureDeserializationDetector extends BaseSecurityDetector {
10
- constructor();
11
- scan(content: string, filePath: string): Promise<SecurityVulnerability[]>;
12
- }
@@ -1,109 +0,0 @@
1
- /**
2
- * Insecure Deserialization Detector
3
- *
4
- * Detects insecure deserialization vulnerabilities
5
- * OWASP A08:2021 - Software and Data Integrity Failures
6
- */
7
- import { BaseSecurityDetector } from '../base-detector.js';
8
- export class InsecureDeserializationDetector extends BaseSecurityDetector {
9
- constructor() {
10
- super({
11
- id: 'insecure-deserialization',
12
- name: 'Insecure Deserialization',
13
- description: 'Detects insecure deserialization vulnerabilities',
14
- severity: 'high',
15
- owaspCategory: 'A08:2021 - Software and Data Integrity Failures',
16
- cweId: 'CWE-502',
17
- });
18
- }
19
- async scan(content, filePath) {
20
- if (!this.appliesTo(filePath)) {
21
- return [];
22
- }
23
- const vulnerabilities = [];
24
- // Pattern 1: JSON.parse with user input without validation
25
- const jsonParsePattern = /JSON\.parse\((?:req\.|params\.|query\.|input|user)[^)]+\)/gi;
26
- let match;
27
- while ((match = jsonParsePattern.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, 'JSON.parse with user input without validation may lead to prototype pollution', 'Validate JSON structure after parsing and use Object.create(null) to avoid prototype pollution', [
34
- 'https://owasp.org/www-community/vulnerabilities/Deserialization_of_untrusted_data',
35
- 'https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html',
36
- ]));
37
- }
38
- // Pattern 2: eval() with JSON (extremely dangerous)
39
- const evalJsonPattern = /eval\([^)]*(?:JSON|json|parse)/gi;
40
- while ((match = evalJsonPattern.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, 'Using eval() for JSON parsing is extremely dangerous', 'Use JSON.parse() instead of eval()', [
47
- 'https://owasp.org/www-community/attacks/Code_Injection',
48
- ]));
49
- }
50
- // Pattern 3: Node.js serialize packages with user input
51
- const serializePackages = ['node-serialize', 'serialize-javascript', 'funcster'];
52
- for (const pkg of serializePackages) {
53
- const pattern = new RegExp(`require\\(['"\`]${pkg}['"\`]\\)`, 'gi');
54
- let pkgMatch;
55
- while ((pkgMatch = pattern.exec(content)) !== null) {
56
- // Check if there's deserialization with user input nearby
57
- const contextStart = pkgMatch.index;
58
- const contextEnd = Math.min(content.length, pkgMatch.index + 500);
59
- const context = content.substring(contextStart, contextEnd);
60
- if (/(?:unserialize|deserialize|parse)\([^)]*(?:req\.|params\.|query\.|input|user)/i.test(context)) {
61
- const line = this.findLineNumber(content, pkgMatch.index);
62
- const code = this.extractCodeSnippet(content, pkgMatch.index, 2);
63
- vulnerabilities.push(this.createVulnerability(filePath, line, code, `Package ${pkg} used for deserialization of user input is dangerous`, 'Avoid deserializing untrusted data. Use JSON.parse() with validation', [
64
- 'https://owasp.org/www-community/vulnerabilities/Deserialization_of_untrusted_data',
65
- ]));
66
- }
67
- }
68
- }
69
- // Pattern 4: Object.assign with user input (prototype pollution)
70
- const objectAssignPattern = /Object\.assign\([^,)]*,\s*(?:req\.|params\.|query\.|input|user)/gi;
71
- while ((match = objectAssignPattern.exec(content)) !== null) {
72
- if (this.shouldIgnore(content, match.index)) {
73
- continue;
74
- }
75
- const line = this.findLineNumber(content, match.index);
76
- const code = this.extractCodeSnippet(content, match.index, 1);
77
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Object.assign with user input may lead to prototype pollution', 'Validate and sanitize user input before using Object.assign. Consider using Object.create(null)', [
78
- 'https://owasp.org/www-community/vulnerabilities/Deserialization_of_untrusted_data',
79
- 'https://cheatsheetseries.owasp.org/cheatsheets/Prototype_Pollution_Prevention_Cheat_Sheet.html',
80
- ]));
81
- }
82
- // Pattern 5: Spread operator with user input
83
- const spreadPattern = /\{\.\.\.(?:req\.|params\.|query\.|input|user)[^}]*\}/gi;
84
- while ((match = spreadPattern.exec(content)) !== null) {
85
- if (this.shouldIgnore(content, match.index)) {
86
- continue;
87
- }
88
- const line = this.findLineNumber(content, match.index);
89
- const code = this.extractCodeSnippet(content, match.index, 1);
90
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'Spread operator with user input may lead to prototype pollution', 'Validate user input before spreading. Use allowlist of permitted fields', [
91
- 'https://cheatsheetseries.owasp.org/cheatsheets/Prototype_Pollution_Prevention_Cheat_Sheet.html',
92
- ]));
93
- }
94
- // Pattern 6: vm module with user input
95
- const vmPattern = /(?:runInContext|runInNewContext|runInThisContext)\([^)]*(?:req\.|params\.|query\.|input|user)/gi;
96
- while ((match = vmPattern.exec(content)) !== null) {
97
- if (this.shouldIgnore(content, match.index)) {
98
- continue;
99
- }
100
- const line = this.findLineNumber(content, match.index);
101
- const code = this.extractCodeSnippet(content, match.index, 1);
102
- vulnerabilities.push(this.createVulnerability(filePath, line, code, 'vm module with user input is extremely dangerous', 'Never execute user-provided code. Find alternative solutions', [
103
- 'https://nodejs.org/api/vm.html#vm_vm_executing_javascript',
104
- ]));
105
- }
106
- return vulnerabilities;
107
- }
108
- }
109
- //# sourceMappingURL=insecure-deserialization-detector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insecure-deserialization-detector.js","sourceRoot":"","sources":["../../../../src/analyzers/security/detectors/insecure-deserialization-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,MAAM,OAAO,+BAAgC,SAAQ,oBAAoB;IACvE;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,0BAA0B;YAC9B,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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,iEAAiE,EACjE,yEAAyE,EACzE;gBACE,gGAAgG;aACjG,CACF,CACF,CAAC;QACJ,CAAC;QAED,uCAAuC;QACvC,MAAM,SAAS,GAAG,iGAAiG,CAAC;QACpH,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAClD,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,kDAAkD,EAClD,8DAA8D,EAC9D;gBACE,2DAA2D;aAC5D,CACF,CACF,CAAC;QACJ,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -1,12 +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
- import type { SecurityVulnerability } from '../types.js';
9
- export declare class InsecureRandomDetector extends BaseSecurityDetector {
10
- constructor();
11
- scan(content: string, filePath: string): Promise<SecurityVulnerability[]>;
12
- }