@houtini/lm 1.0.13 → 2.0.1

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 (264) hide show
  1. package/README.md +67 -237
  2. package/dist/index.d.ts +5 -3
  3. package/dist/index.js +149 -213
  4. package/dist/index.js.map +1 -1
  5. package/package.json +23 -32
  6. package/server.json +44 -0
  7. package/CHANGELOG.md +0 -282
  8. package/dist/cache/analysis-cache.d.ts +0 -33
  9. package/dist/cache/analysis-cache.d.ts.map +0 -1
  10. package/dist/cache/analysis-cache.js +0 -56
  11. package/dist/cache/analysis-cache.js.map +0 -1
  12. package/dist/cache/cache-manager.d.ts +0 -29
  13. package/dist/cache/cache-manager.d.ts.map +0 -1
  14. package/dist/cache/cache-manager.js +0 -85
  15. package/dist/cache/cache-manager.js.map +0 -1
  16. package/dist/cache/index.d.ts +0 -16
  17. package/dist/cache/index.d.ts.map +0 -1
  18. package/dist/cache/index.js +0 -17
  19. package/dist/cache/index.js.map +0 -1
  20. package/dist/cache/prompt-cache.d.ts +0 -33
  21. package/dist/cache/prompt-cache.d.ts.map +0 -1
  22. package/dist/cache/prompt-cache.js +0 -61
  23. package/dist/cache/prompt-cache.js.map +0 -1
  24. package/dist/config.d.ts +0 -41
  25. package/dist/config.d.ts.map +0 -1
  26. package/dist/config.js +0 -71
  27. package/dist/config.js.map +0 -1
  28. package/dist/core/ThreeStagePromptManager.d.ts +0 -23
  29. package/dist/core/ThreeStagePromptManager.d.ts.map +0 -1
  30. package/dist/core/ThreeStagePromptManager.js +0 -118
  31. package/dist/core/ThreeStagePromptManager.js.map +0 -1
  32. package/dist/index.d.ts.map +0 -1
  33. package/dist/plugins/base-plugin.d.ts +0 -55
  34. package/dist/plugins/base-plugin.d.ts.map +0 -1
  35. package/dist/plugins/base-plugin.js +0 -120
  36. package/dist/plugins/base-plugin.js.map +0 -1
  37. package/dist/plugins/index.d.ts +0 -58
  38. package/dist/plugins/index.d.ts.map +0 -1
  39. package/dist/plugins/index.js +0 -162
  40. package/dist/plugins/index.js.map +0 -1
  41. package/dist/plugins/types.d.ts +0 -5
  42. package/dist/plugins/types.d.ts.map +0 -1
  43. package/dist/plugins/types.js +0 -5
  44. package/dist/plugins/types.js.map +0 -1
  45. package/dist/prompts/analyze/code-quality.d.ts +0 -116
  46. package/dist/prompts/analyze/code-quality.d.ts.map +0 -1
  47. package/dist/prompts/analyze/code-quality.js +0 -437
  48. package/dist/prompts/analyze/code-quality.js.map +0 -1
  49. package/dist/prompts/analyze/compare-integration.d.ts +0 -130
  50. package/dist/prompts/analyze/compare-integration.d.ts.map +0 -1
  51. package/dist/prompts/analyze/compare-integration.js +0 -547
  52. package/dist/prompts/analyze/compare-integration.js.map +0 -1
  53. package/dist/prompts/analyze/count-files.d.ts +0 -109
  54. package/dist/prompts/analyze/count-files.d.ts.map +0 -1
  55. package/dist/prompts/analyze/count-files.js +0 -403
  56. package/dist/prompts/analyze/count-files.js.map +0 -1
  57. package/dist/prompts/analyze/database-queries.d.ts +0 -156
  58. package/dist/prompts/analyze/database-queries.d.ts.map +0 -1
  59. package/dist/prompts/analyze/database-queries.js +0 -763
  60. package/dist/prompts/analyze/database-queries.js.map +0 -1
  61. package/dist/prompts/analyze/dependencies.d.ts +0 -97
  62. package/dist/prompts/analyze/dependencies.d.ts.map +0 -1
  63. package/dist/prompts/analyze/dependencies.js +0 -337
  64. package/dist/prompts/analyze/dependencies.js.map +0 -1
  65. package/dist/prompts/analyze/diff-signatures.d.ts +0 -139
  66. package/dist/prompts/analyze/diff-signatures.d.ts.map +0 -1
  67. package/dist/prompts/analyze/diff-signatures.js +0 -708
  68. package/dist/prompts/analyze/diff-signatures.js.map +0 -1
  69. package/dist/prompts/analyze/find-patterns.d.ts +0 -128
  70. package/dist/prompts/analyze/find-patterns.d.ts.map +0 -1
  71. package/dist/prompts/analyze/find-patterns.js +0 -524
  72. package/dist/prompts/analyze/find-patterns.js.map +0 -1
  73. package/dist/prompts/analyze/find-unused-css.d.ts +0 -151
  74. package/dist/prompts/analyze/find-unused-css.d.ts.map +0 -1
  75. package/dist/prompts/analyze/find-unused-css.js +0 -760
  76. package/dist/prompts/analyze/find-unused-css.js.map +0 -1
  77. package/dist/prompts/analyze/n8n-workflow.d.ts +0 -137
  78. package/dist/prompts/analyze/n8n-workflow.d.ts.map +0 -1
  79. package/dist/prompts/analyze/n8n-workflow.js +0 -533
  80. package/dist/prompts/analyze/n8n-workflow.js.map +0 -1
  81. package/dist/prompts/analyze/project-structure.d.ts +0 -126
  82. package/dist/prompts/analyze/project-structure.d.ts.map +0 -1
  83. package/dist/prompts/analyze/project-structure.js +0 -573
  84. package/dist/prompts/analyze/project-structure.js.map +0 -1
  85. package/dist/prompts/analyze/security-audit.d.ts +0 -142
  86. package/dist/prompts/analyze/security-audit.d.ts.map +0 -1
  87. package/dist/prompts/analyze/security-audit.js +0 -641
  88. package/dist/prompts/analyze/security-audit.js.map +0 -1
  89. package/dist/prompts/analyze/single-file.d.ts +0 -162
  90. package/dist/prompts/analyze/single-file.d.ts.map +0 -1
  91. package/dist/prompts/analyze/single-file.js +0 -669
  92. package/dist/prompts/analyze/single-file.js.map +0 -1
  93. package/dist/prompts/analyze/trace-execution.d.ts +0 -126
  94. package/dist/prompts/analyze/trace-execution.d.ts.map +0 -1
  95. package/dist/prompts/analyze/trace-execution.js +0 -613
  96. package/dist/prompts/analyze/trace-execution.js.map +0 -1
  97. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts +0 -116
  98. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts.map +0 -1
  99. package/dist/prompts/analyze/wordpress-plugin-audit.js +0 -456
  100. package/dist/prompts/analyze/wordpress-plugin-audit.js.map +0 -1
  101. package/dist/prompts/analyze/wordpress-plugin-readiness.d.ts +0 -103
  102. package/dist/prompts/analyze/wordpress-plugin-readiness.d.ts.map +0 -1
  103. package/dist/prompts/analyze/wordpress-plugin-readiness.js +0 -506
  104. package/dist/prompts/analyze/wordpress-plugin-readiness.js.map +0 -1
  105. package/dist/prompts/analyze/wordpress-security.d.ts +0 -146
  106. package/dist/prompts/analyze/wordpress-security.d.ts.map +0 -1
  107. package/dist/prompts/analyze/wordpress-security.js +0 -702
  108. package/dist/prompts/analyze/wordpress-security.js.map +0 -1
  109. package/dist/prompts/analyze/wordpress-theme-audit.d.ts +0 -114
  110. package/dist/prompts/analyze/wordpress-theme-audit.d.ts.map +0 -1
  111. package/dist/prompts/analyze/wordpress-theme-audit.js +0 -540
  112. package/dist/prompts/analyze/wordpress-theme-audit.js.map +0 -1
  113. package/dist/prompts/custom/custom-prompt.d.ts +0 -135
  114. package/dist/prompts/custom/custom-prompt.d.ts.map +0 -1
  115. package/dist/prompts/custom/custom-prompt.js +0 -421
  116. package/dist/prompts/custom/custom-prompt.js.map +0 -1
  117. package/dist/prompts/fun/arcade-game.d.ts +0 -152
  118. package/dist/prompts/fun/arcade-game.d.ts.map +0 -1
  119. package/dist/prompts/fun/arcade-game.js +0 -657
  120. package/dist/prompts/fun/arcade-game.js.map +0 -1
  121. package/dist/prompts/fun/create_text_adventure.d.ts +0 -100
  122. package/dist/prompts/fun/create_text_adventure.d.ts.map +0 -1
  123. package/dist/prompts/fun/create_text_adventure.js +0 -401
  124. package/dist/prompts/fun/create_text_adventure.js.map +0 -1
  125. package/dist/prompts/fun/css-art-generator.d.ts +0 -168
  126. package/dist/prompts/fun/css-art-generator.d.ts.map +0 -1
  127. package/dist/prompts/fun/css-art-generator.js +0 -831
  128. package/dist/prompts/fun/css-art-generator.js.map +0 -1
  129. package/dist/prompts/generate/project-documentation.d.ts +0 -137
  130. package/dist/prompts/generate/project-documentation.d.ts.map +0 -1
  131. package/dist/prompts/generate/project-documentation.js +0 -670
  132. package/dist/prompts/generate/project-documentation.js.map +0 -1
  133. package/dist/prompts/generate/refactoring.d.ts +0 -164
  134. package/dist/prompts/generate/refactoring.d.ts.map +0 -1
  135. package/dist/prompts/generate/refactoring.js +0 -625
  136. package/dist/prompts/generate/refactoring.js.map +0 -1
  137. package/dist/prompts/generate/responsive-component.d.ts +0 -147
  138. package/dist/prompts/generate/responsive-component.d.ts.map +0 -1
  139. package/dist/prompts/generate/responsive-component.js +0 -957
  140. package/dist/prompts/generate/responsive-component.js.map +0 -1
  141. package/dist/prompts/generate/typescript-conversion.d.ts +0 -144
  142. package/dist/prompts/generate/typescript-conversion.d.ts.map +0 -1
  143. package/dist/prompts/generate/typescript-conversion.js +0 -531
  144. package/dist/prompts/generate/typescript-conversion.js.map +0 -1
  145. package/dist/prompts/generate/unit-tests.d.ts +0 -139
  146. package/dist/prompts/generate/unit-tests.d.ts.map +0 -1
  147. package/dist/prompts/generate/unit-tests.js +0 -582
  148. package/dist/prompts/generate/unit-tests.js.map +0 -1
  149. package/dist/prompts/generate/wordpress-plugin.d.ts +0 -179
  150. package/dist/prompts/generate/wordpress-plugin.d.ts.map +0 -1
  151. package/dist/prompts/generate/wordpress-plugin.js +0 -767
  152. package/dist/prompts/generate/wordpress-plugin.js.map +0 -1
  153. package/dist/prompts/generate/wordpress-theme-from-static.d.ts +0 -177
  154. package/dist/prompts/generate/wordpress-theme-from-static.d.ts.map +0 -1
  155. package/dist/prompts/generate/wordpress-theme-from-static.js +0 -699
  156. package/dist/prompts/generate/wordpress-theme-from-static.js.map +0 -1
  157. package/dist/prompts/shared/cache-manager.d.ts +0 -45
  158. package/dist/prompts/shared/cache-manager.d.ts.map +0 -1
  159. package/dist/prompts/shared/cache-manager.js +0 -129
  160. package/dist/prompts/shared/cache-manager.js.map +0 -1
  161. package/dist/prompts/shared/helpers.d.ts +0 -39
  162. package/dist/prompts/shared/helpers.d.ts.map +0 -1
  163. package/dist/prompts/shared/helpers.js +0 -151
  164. package/dist/prompts/shared/helpers.js.map +0 -1
  165. package/dist/prompts/shared/templates.d.ts +0 -35
  166. package/dist/prompts/shared/templates.d.ts.map +0 -1
  167. package/dist/prompts/shared/templates.js +0 -77
  168. package/dist/prompts/shared/templates.js.map +0 -1
  169. package/dist/prompts/shared/types.d.ts +0 -112
  170. package/dist/prompts/shared/types.d.ts.map +0 -1
  171. package/dist/prompts/shared/types.js +0 -5
  172. package/dist/prompts/shared/types.js.map +0 -1
  173. package/dist/prompts/system/find-unused-files.d.ts +0 -106
  174. package/dist/prompts/system/find-unused-files.d.ts.map +0 -1
  175. package/dist/prompts/system/find-unused-files.js +0 -357
  176. package/dist/prompts/system/find-unused-files.js.map +0 -1
  177. package/dist/security/index.d.ts +0 -39
  178. package/dist/security/index.d.ts.map +0 -1
  179. package/dist/security/index.js +0 -46
  180. package/dist/security/index.js.map +0 -1
  181. package/dist/security/integration-helpers.d.ts +0 -121
  182. package/dist/security/integration-helpers.d.ts.map +0 -1
  183. package/dist/security/integration-helpers.js +0 -190
  184. package/dist/security/integration-helpers.js.map +0 -1
  185. package/dist/security/output-encoder.d.ts +0 -94
  186. package/dist/security/output-encoder.d.ts.map +0 -1
  187. package/dist/security/output-encoder.js +0 -295
  188. package/dist/security/output-encoder.js.map +0 -1
  189. package/dist/security/prompt-injection-guard.d.ts +0 -59
  190. package/dist/security/prompt-injection-guard.d.ts.map +0 -1
  191. package/dist/security/prompt-injection-guard.js +0 -249
  192. package/dist/security/prompt-injection-guard.js.map +0 -1
  193. package/dist/security/sanitisation.d.ts +0 -67
  194. package/dist/security/sanitisation.d.ts.map +0 -1
  195. package/dist/security/sanitisation.js +0 -398
  196. package/dist/security/sanitisation.js.map +0 -1
  197. package/dist/security/security-service.d.ts +0 -103
  198. package/dist/security/security-service.d.ts.map +0 -1
  199. package/dist/security/security-service.js +0 -303
  200. package/dist/security/security-service.js.map +0 -1
  201. package/dist/security-config.d.ts +0 -45
  202. package/dist/security-config.d.ts.map +0 -1
  203. package/dist/security-config.js +0 -63
  204. package/dist/security-config.js.map +0 -1
  205. package/dist/system/function-list.d.ts +0 -61
  206. package/dist/system/function-list.d.ts.map +0 -1
  207. package/dist/system/function-list.js +0 -111
  208. package/dist/system/function-list.js.map +0 -1
  209. package/dist/system/function-registry.d.ts +0 -23
  210. package/dist/system/function-registry.d.ts.map +0 -1
  211. package/dist/system/function-registry.js +0 -136
  212. package/dist/system/function-registry.js.map +0 -1
  213. package/dist/system/health-check.d.ts +0 -33
  214. package/dist/system/health-check.d.ts.map +0 -1
  215. package/dist/system/health-check.js +0 -98
  216. package/dist/system/health-check.js.map +0 -1
  217. package/dist/system/path-resolver.d.ts +0 -55
  218. package/dist/system/path-resolver.d.ts.map +0 -1
  219. package/dist/system/path-resolver.js +0 -90
  220. package/dist/system/path-resolver.js.map +0 -1
  221. package/dist/templates/plugin-template.d.ts +0 -121
  222. package/dist/templates/plugin-template.d.ts.map +0 -1
  223. package/dist/templates/plugin-template.js +0 -454
  224. package/dist/templates/plugin-template.js.map +0 -1
  225. package/dist/types/chunking-types.d.ts +0 -88
  226. package/dist/types/chunking-types.d.ts.map +0 -1
  227. package/dist/types/chunking-types.js +0 -18
  228. package/dist/types/chunking-types.js.map +0 -1
  229. package/dist/types/prompt-stages.d.ts +0 -30
  230. package/dist/types/prompt-stages.d.ts.map +0 -1
  231. package/dist/types/prompt-stages.js +0 -6
  232. package/dist/types/prompt-stages.js.map +0 -1
  233. package/dist/types.d.ts +0 -45
  234. package/dist/types.d.ts.map +0 -1
  235. package/dist/types.js +0 -6
  236. package/dist/types.js.map +0 -1
  237. package/dist/utils/css-parser.d.ts +0 -26
  238. package/dist/utils/css-parser.d.ts.map +0 -1
  239. package/dist/utils/css-parser.js +0 -117
  240. package/dist/utils/css-parser.js.map +0 -1
  241. package/dist/utils/path-resolver.d.ts +0 -13
  242. package/dist/utils/path-resolver.d.ts.map +0 -1
  243. package/dist/utils/path-resolver.js +0 -78
  244. package/dist/utils/path-resolver.js.map +0 -1
  245. package/dist/utils/plugin-utilities.d.ts +0 -176
  246. package/dist/utils/plugin-utilities.d.ts.map +0 -1
  247. package/dist/utils/plugin-utilities.js +0 -269
  248. package/dist/utils/plugin-utilities.js.map +0 -1
  249. package/dist/utils/streamHandler.d.ts +0 -3
  250. package/dist/utils/streamHandler.d.ts.map +0 -1
  251. package/dist/utils/streamHandler.js +0 -137
  252. package/dist/utils/streamHandler.js.map +0 -1
  253. package/dist/validation/output-validator.d.ts +0 -136
  254. package/dist/validation/output-validator.d.ts.map +0 -1
  255. package/dist/validation/output-validator.js +0 -262
  256. package/dist/validation/output-validator.js.map +0 -1
  257. package/dist/validation/response-factory.d.ts +0 -44
  258. package/dist/validation/response-factory.d.ts.map +0 -1
  259. package/dist/validation/response-factory.js +0 -202
  260. package/dist/validation/response-factory.js.map +0 -1
  261. package/dist/validation/schemas.d.ts +0 -519
  262. package/dist/validation/schemas.d.ts.map +0 -1
  263. package/dist/validation/schemas.js +0 -6
  264. package/dist/validation/schemas.js.map +0 -1
@@ -1,641 +0,0 @@
1
- /**
2
- * Plugin Template - Modern v4.2 (Single Source of Truth)
3
- *
4
- * Universal template that intelligently handles both single-file and multi-file analysis
5
- * Automatically detects analysis type based on provided parameters
6
- *
7
- * Copy this template for creating any new plugin - it adapts to your needs
8
- */
9
- import { BasePlugin } from '../../plugins/base-plugin.js';
10
- import { ThreeStagePromptManager } from '../../core/ThreeStagePromptManager.js';
11
- import { withSecurity } from '../../security/integration-helpers.js';
12
- import { readFileContent } from '../shared/helpers.js';
13
- import { ModelSetup, ResponseProcessor, ParameterValidator, ErrorHandler, MultiFileAnalysis, TokenCalculator } from '../../utils/plugin-utilities.js';
14
- import { getAnalysisCache } from '../../cache/index.js';
15
- export class SecurityAuditor extends BasePlugin {
16
- constructor() {
17
- super();
18
- this.name = 'security_audit';
19
- this.category = 'analyze';
20
- this.description = 'Perform comprehensive security audit across entire project, analyzing data flows, authentication chains, and cross-file vulnerabilities with OWASP compliance checking';
21
- // Universal parameter set - supports both single and multi-file scenarios
22
- this.parameters = {
23
- // Single-file parameters
24
- code: {
25
- type: 'string',
26
- description: 'The code to analyze for security issues (for single-file analysis)',
27
- required: false
28
- },
29
- filePath: {
30
- type: 'string',
31
- description: 'Path to single file to analyze for security vulnerabilities',
32
- required: false
33
- },
34
- // Multi-file parameters
35
- projectPath: {
36
- type: 'string',
37
- description: 'Absolute path to project root directory',
38
- required: false
39
- },
40
- files: {
41
- type: 'array',
42
- description: 'Array of specific file paths (for multi-file analysis)',
43
- required: false,
44
- items: { type: 'string' }
45
- },
46
- maxDepth: {
47
- type: 'number',
48
- description: 'Maximum directory depth for multi-file discovery (1-5)',
49
- required: false,
50
- default: 4
51
- },
52
- // Security-specific parameters
53
- projectType: {
54
- type: 'string',
55
- description: 'Project type for specific security checks',
56
- required: false,
57
- enum: ['wordpress-plugin', 'wordpress-theme', 'react-app', 'react-component', 'node-api', 'browser-extension', 'cli-tool', 'n8n-node', 'n8n-workflow', 'html-component', 'generic'],
58
- default: 'generic'
59
- },
60
- auditDepth: {
61
- type: 'string',
62
- description: 'Depth of security audit',
63
- enum: ['basic', 'standard', 'comprehensive'],
64
- default: 'standard',
65
- required: false
66
- },
67
- includeOwasp: {
68
- type: 'boolean',
69
- description: 'Include OWASP Top 10 checks',
70
- required: false,
71
- default: true
72
- },
73
- focusAreas: {
74
- type: 'array',
75
- description: 'Specific areas to focus on: authentication, data-flow, input-validation, authorization',
76
- required: false,
77
- items: { type: 'string' }
78
- },
79
- // Universal parameters
80
- language: {
81
- type: 'string',
82
- description: 'Programming language',
83
- required: false,
84
- default: 'javascript'
85
- },
86
- analysisDepth: {
87
- type: 'string',
88
- description: 'Level of analysis detail',
89
- enum: ['basic', 'detailed', 'comprehensive'],
90
- default: 'detailed',
91
- required: false
92
- },
93
- analysisType: {
94
- type: 'string',
95
- description: 'Type of analysis to perform',
96
- enum: ['security', 'owasp', 'comprehensive'],
97
- default: 'comprehensive',
98
- required: false
99
- }
100
- };
101
- this.analysisCache = getAnalysisCache();
102
- this.multiFileAnalysis = new MultiFileAnalysis();
103
- // Cache and analysis utilities are initialized above
104
- }
105
- async execute(params, llmClient) {
106
- return await withSecurity(this, params, llmClient, async (secureParams) => {
107
- try {
108
- // 1. Auto-detect analysis mode based on parameters
109
- const analysisMode = this.detectAnalysisMode(secureParams);
110
- // 2. Validate parameters based on detected mode
111
- this.validateParameters(secureParams, analysisMode);
112
- // 3. Setup model
113
- const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
114
- // 4. Route to appropriate analysis method
115
- if (analysisMode === 'single-file') {
116
- return await this.executeSingleFileAnalysis(secureParams, model, contextLength);
117
- }
118
- else {
119
- return await this.executeMultiFileAnalysis(secureParams, model, contextLength);
120
- }
121
- }
122
- catch (error) {
123
- return ErrorHandler.createExecutionError('security_audit', error);
124
- }
125
- });
126
- }
127
- /**
128
- * Auto-detect whether this is single-file or multi-file analysis
129
- */
130
- detectAnalysisMode(params) {
131
- // Single-file indicators (check these first)
132
- if (params.code || params.filePath) {
133
- return 'single-file';
134
- }
135
- // Multi-file indicators
136
- if (params.projectPath || params.files) {
137
- return 'multi-file';
138
- }
139
- // Default to multi-file for project security audits
140
- return 'multi-file';
141
- }
142
- /**
143
- * Validate parameters based on detected analysis mode
144
- */
145
- validateParameters(params, mode) {
146
- if (mode === 'single-file') {
147
- // For single-file, we need either code OR filePath
148
- if (!params.code && !params.filePath) {
149
- throw new Error('Either code or filePath must be provided for single-file analysis');
150
- }
151
- }
152
- else {
153
- // For multi-file, we need either projectPath OR files array
154
- if (!params.projectPath && !params.files) {
155
- throw new Error('Either projectPath or files array must be provided');
156
- }
157
- ParameterValidator.validateDepth(params);
158
- }
159
- // Universal validations
160
- ParameterValidator.validateEnum(params, 'analysisType', ['security', 'owasp', 'comprehensive']);
161
- ParameterValidator.validateEnum(params, 'analysisDepth', ['basic', 'detailed', 'comprehensive']);
162
- ParameterValidator.validateEnum(params, 'projectType', ['wordpress-plugin', 'wordpress-theme', 'react-app', 'react-component', 'node-api', 'browser-extension', 'cli-tool', 'n8n-node', 'n8n-workflow', 'html-component', 'generic']);
163
- }
164
- /**
165
- * Execute single-file analysis
166
- */
167
- async executeSingleFileAnalysis(params, model, contextLength) {
168
- // Process single file input
169
- let codeToAnalyze = params.code;
170
- if (params.filePath) {
171
- codeToAnalyze = await readFileContent(params.filePath);
172
- }
173
- // Generate prompt stages for single file
174
- const promptStages = this.getSingleFilePromptStages({
175
- ...params,
176
- code: codeToAnalyze
177
- });
178
- // Execute with appropriate method
179
- const promptManager = new ThreeStagePromptManager();
180
- const needsChunking = TokenCalculator.needsChunking(promptStages, contextLength);
181
- if (needsChunking) {
182
- const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength);
183
- const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize);
184
- const conversation = promptManager.createChunkedConversation(promptStages, dataChunks);
185
- const messages = [
186
- conversation.systemMessage,
187
- ...conversation.dataMessages,
188
- conversation.analysisMessage
189
- ];
190
- return await ResponseProcessor.executeChunked(messages, model, contextLength, 'security_audit', 'single');
191
- }
192
- else {
193
- return await ResponseProcessor.executeDirect(promptStages, model, contextLength, 'security_audit');
194
- }
195
- }
196
- /**
197
- * Execute multi-file analysis
198
- */
199
- async executeMultiFileAnalysis(params, model, contextLength) {
200
- // Discover files
201
- let filesToAnalyze = params.files ||
202
- await this.discoverRelevantFiles(params.projectPath, params.maxDepth, params.projectType);
203
- // Perform multi-file analysis with caching
204
- const analysisResult = await this.performMultiFileAnalysis(filesToAnalyze, params, model, contextLength);
205
- // Generate prompt stages for multi-file
206
- const promptStages = this.getMultiFilePromptStages({
207
- ...params,
208
- analysisResult,
209
- fileCount: filesToAnalyze.length
210
- });
211
- // Always use chunking for multi-file
212
- const promptManager = new ThreeStagePromptManager();
213
- const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength);
214
- const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize);
215
- const conversation = promptManager.createChunkedConversation(promptStages, dataChunks);
216
- const messages = [
217
- conversation.systemMessage,
218
- ...conversation.dataMessages,
219
- conversation.analysisMessage
220
- ];
221
- return await ResponseProcessor.executeChunked(messages, model, contextLength, 'security_audit', 'multifile');
222
- }
223
- /**
224
- * Implement single-file security audit prompt stages
225
- */
226
- getSingleFilePromptStages(params) {
227
- const { code, language, analysisDepth, projectType, includeOwasp, focusAreas } = params;
228
- const systemAndContext = `You are a senior cybersecurity expert with 15+ years of experience in application security, penetration testing, and secure code review. You specialize in identifying vulnerabilities across all major programming languages and frameworks.
229
-
230
- **YOUR EXPERTISE:**
231
- - OWASP Top 10 vulnerabilities and mitigation strategies
232
- - Cross-site scripting (XSS), SQL injection, and injection attack vectors
233
- - Authentication bypass and authorization flaws
234
- - Cryptographic failures and insecure data storage
235
- - Security misconfigurations and exposed components
236
- - Modern framework security patterns (React, Node.js, PHP, etc.)
237
- - Static code analysis and dynamic security testing
238
- - Compliance with security standards (NIST, ISO 27001, PCI DSS)
239
-
240
- **ANALYSIS CONTEXT:**
241
- - Programming Language: ${language}
242
- - Project Type: ${projectType}
243
- - Analysis Depth: ${analysisDepth}
244
- - OWASP Analysis: ${includeOwasp ? 'ENABLED - Include OWASP Top 10 checks' : 'DISABLED'}
245
- - Focus Areas: ${focusAreas?.length > 0 ? focusAreas.join(', ') : 'All security domains'}
246
- - Mode: Single File Security Analysis
247
-
248
- **SECURITY ASSESSMENT METHODOLOGY:**
249
- 1. **Static Code Analysis**: Examine code patterns for known vulnerability signatures
250
- 2. **Data Flow Analysis**: Trace user input from entry points through processing
251
- 3. **Authentication/Authorization**: Verify access controls and privilege escalation risks
252
- 4. **Input Validation**: Check for sanitization and validation of all user inputs
253
- 5. **Output Encoding**: Ensure proper encoding prevents XSS and injection attacks
254
- 6. **Cryptographic Review**: Assess encryption, hashing, and key management practices
255
- 7. **Configuration Security**: Review security-relevant configuration and defaults
256
- 8. **Business Logic Flaws**: Identify application-specific security weaknesses
257
-
258
- Your task is to perform a comprehensive security audit of this individual file, identifying vulnerabilities with precise locations, assessing their severity, and providing actionable remediation guidance.`;
259
- const dataPayload = `**SECURITY AUDIT TARGET:**
260
-
261
- File: ${params.filePath || 'Inline Code'}
262
- Language: ${language}
263
- Project Type: ${projectType}
264
-
265
- **SOURCE CODE TO AUDIT:**
266
-
267
- \`\`\`${language}
268
- ${code}
269
- \`\`\``;
270
- const outputInstructions = `**PROVIDE COMPREHENSIVE SECURITY AUDIT REPORT:**
271
-
272
- Your analysis must be thorough, actionable, and prioritized by business risk. Focus on real vulnerabilities that could be exploited, not theoretical concerns.
273
-
274
- **EXECUTIVE SUMMARY:**
275
- Begin with an overall assessment including:
276
- - **Overall Risk Level**: Critical, High, Medium, or Low
277
- - **Total Vulnerabilities Found**: Count by severity (critical, high, medium, low)
278
- - **Most Critical Issue**: Brief description of the most severe vulnerability
279
- - **OWASP Compliance Status**: How well the code follows OWASP Top 10 guidelines
280
- - **Business Impact**: What these vulnerabilities mean for the organization
281
-
282
- **DETAILED VULNERABILITY ASSESSMENT:**
283
- For EACH vulnerability found, provide a comprehensive analysis:
284
-
285
- **Vulnerability Analysis Format:**
286
- - **Vulnerability Name & Type**: Clear, descriptive name of the security issue
287
- - **Severity Level**: CRITICAL, HIGH, MEDIUM, or LOW with justification
288
- - **OWASP Category**: Reference to OWASP Top 10 category if applicable (A01-A10)
289
- - **Location Details**: Specific line numbers, functions, or code sections affected
290
- - **Vulnerable Code**: Show the exact problematic code snippet
291
- - **Attack Vector**: Detailed explanation of how an attacker would exploit this
292
- - **Impact Assessment**: What happens if successfully exploited (data loss, access, etc.)
293
- - **Proof of Concept**: Example exploit code or attack payload demonstrating the vulnerability
294
- - **Fix Implementation**: Specific code changes needed with secure implementation examples
295
- - **Prevention Strategy**: Long-term approaches to prevent similar issues
296
-
297
- **SECURITY STRENGTHS ASSESSMENT:**
298
- Highlight positive security practices found:
299
- - **Good Practices Identified**: Security measures already implemented correctly
300
- - **Framework Security Features**: Built-in security features being used appropriately
301
- - **Defense in Depth**: Multiple security layers and their effectiveness
302
- - **Code Quality**: Security-aware coding practices being followed
303
-
304
- **RISK-PRIORITIZED ACTION PLAN:**
305
- Organize remediation by urgency and impact:
306
-
307
- **IMMEDIATE ACTIONS** (Fix within 24 hours):
308
- - Critical and high severity vulnerabilities that pose immediate risk
309
- - Specific steps for emergency patching
310
-
311
- **SHORT-TERM IMPROVEMENTS** (Fix within 1 week):
312
- - Medium severity issues and important security enhancements
313
- - Implementation timeline and resource requirements
314
-
315
- **LONG-TERM ENHANCEMENTS** (Address in next development cycle):
316
- - Low severity items and architectural security improvements
317
- - Strategic security initiatives and process improvements
318
-
319
- **SECURE CODE EXAMPLES:**
320
- Provide practical, working code examples demonstrating:
321
- - **Input Validation**: Proper techniques for validating and sanitizing user input
322
- - **Output Encoding**: Methods to prevent XSS and injection attacks
323
- - **Authentication Patterns**: Secure authentication and session management
324
- - **Database Security**: Parameterized queries and database access controls
325
- - **Error Handling**: Secure error handling that doesn't leak information
326
- - **Access Controls**: Proper authorization and privilege checking
327
-
328
- **IMPLEMENTATION GUIDANCE:**
329
- - **Priority Matrix**: Risk vs. effort assessment for each recommendation
330
- - **Dependencies**: Issues that must be fixed together or in sequence
331
- - **Testing Strategy**: How to verify fixes without breaking functionality
332
- - **Monitoring**: What to monitor after implementing security fixes
333
-
334
- **COMPLIANCE & STANDARDS:**
335
- - **Industry Standards**: Alignment with relevant security standards
336
- - **Regulatory Requirements**: Compliance with applicable regulations
337
- - **Best Practices**: Industry best practices being followed or needed
338
-
339
- **CRITICAL REQUIREMENTS:**
340
- - Every vulnerability MUST include precise line numbers where possible
341
- - Every fix MUST include working, tested code examples
342
- - Focus on exploitable vulnerabilities that pose real business risk
343
- - Prioritize recommendations by likelihood and impact of exploitation
344
- - Include specific attack scenarios that clearly demonstrate each vulnerability
345
- - Provide actionable steps that development teams can implement immediately
346
-
347
- Be comprehensive but practical - focus on security issues that matter most to the business and can be realistically addressed by the development team.`;
348
- return { systemAndContext, dataPayload, outputInstructions };
349
- }
350
- /**
351
- * Implement multi-file security audit prompt stages
352
- */
353
- getMultiFilePromptStages(params) {
354
- const { analysisResult, projectType, auditDepth, includeOwasp, fileCount, focusAreas } = params;
355
- const systemAndContext = `You are a senior cybersecurity expert and application security architect with 15+ years of experience in enterprise security audits. You specialize in comprehensive cross-file security analysis and identifying complex attack vectors that span multiple components.
356
-
357
- **YOUR EXPERTISE:**
358
- - Multi-tier application security architecture review
359
- - Cross-component vulnerability analysis and attack chain identification
360
- - Data flow security analysis across entire applications
361
- - Authentication and authorization workflow security
362
- - API security and microservices security patterns
363
- - DevSecOps and secure development lifecycle implementation
364
- - Enterprise compliance (SOX, HIPAA, PCI DSS, GDPR)
365
- - Advanced persistent threat (APT) defense strategies
366
-
367
- **PROJECT SECURITY AUDIT CONTEXT:**
368
- - Project Type: ${projectType}
369
- - Audit Depth: ${auditDepth}
370
- - Files Analyzed: ${fileCount}
371
- - OWASP Analysis: ${includeOwasp ? 'ENABLED - Full OWASP Top 10 coverage' : 'DISABLED'}
372
- - Focus Areas: ${focusAreas?.length > 0 ? focusAreas.join(', ') : 'Comprehensive security domains'}
373
- - Mode: Multi-File Cross-Component Security Analysis
374
-
375
- **MULTI-FILE SECURITY METHODOLOGY:**
376
- 1. **Attack Surface Mapping**: Identify all entry points and data flow paths
377
- 2. **Cross-File Data Flow Analysis**: Trace user input through entire application
378
- 3. **Authentication Chain Analysis**: Review complete auth/authz workflows
379
- 4. **Privilege Escalation Assessment**: Find vertical and horizontal privilege issues
380
- 5. **Business Logic Security**: Identify workflow and process vulnerabilities
381
- 6. **Configuration Drift Analysis**: Find security misconfigurations across components
382
- 7. **Supply Chain Security**: Assess dependencies and third-party component risks
383
- 8. **Architectural Security Patterns**: Evaluate security design patterns and anti-patterns
384
-
385
- Your task is to perform a comprehensive enterprise-grade security audit across all files, focusing on cross-component vulnerabilities, attack chains, and systemic security weaknesses that could compromise the entire application.`;
386
- const dataPayload = `**COMPREHENSIVE PROJECT SECURITY AUDIT DATA:**
387
-
388
- Project Type: ${projectType}
389
- Total Files Analyzed: ${fileCount}
390
- Analysis Scope: ${auditDepth} depth review
391
-
392
- **CROSS-FILE ANALYSIS RESULTS:**
393
-
394
- ${JSON.stringify(analysisResult, null, 2)}`;
395
- const outputInstructions = `**PROVIDE ENTERPRISE-GRADE MULTI-FILE SECURITY AUDIT:**
396
-
397
- Your analysis must identify systemic vulnerabilities, attack chains spanning multiple files, and architectural security flaws. Focus on risks that could lead to complete system compromise.
398
-
399
- **ENTERPRISE-GRADE MULTI-FILE SECURITY ASSESSMENT:**
400
-
401
- **EXECUTIVE SUMMARY:**
402
- - **Overall Security Posture**: Critical, High, Medium, or Low assessment
403
- - **Business Risk Rating**: Extreme, High, Moderate, or Low business impact
404
- - **Total Security Findings**: Count of systemic vulnerabilities, cross-file issues, configuration flaws, and architectural weaknesses
405
- - **Critical Attack Chains**: Description of the most dangerous attack paths that span multiple files
406
- - **Compliance Gaps**: OWASP Top 10 or other compliance issues identified
407
- - **Business Impact**: Potential impact on business operations, data, and reputation
408
-
409
- **CROSS-FILE ATTACK CHAIN ANALYSIS:**
410
- For each attack chain that spans multiple files, provide:
411
-
412
- **Attack Chain Analysis Format:**
413
- - **Attack Chain Name & Severity**: Descriptive name and Critical/High/Medium/Low rating
414
- - **Attack Path Flow**: File A → File B → File C → Complete System Compromise
415
- - **Entry Point Details**: Specific file, function, and line where the attack begins
416
- - **Exploitation Flow**: Step-by-step progression of how the attack moves through files
417
- - **Files Involved**: Complete list of all files that participate in this attack chain
418
- - **Business Function Impact**: What critical business function gets compromised
419
- - **Complete Exploit Scenario**: Full working proof-of-concept demonstrating the attack
420
- - **Systemic Fix Strategy**: Architectural changes needed across all involved files
421
- - **Detection & Monitoring**: How to monitor for this attack pattern in production
422
-
423
- **DATA FLOW SECURITY ANALYSIS:**
424
- - **User Input Entry Points**: Comprehensive mapping of all places user data enters the system
425
- - **Data Processing Chain**: How user data flows through components and transformations
426
- - **Validation Gaps**: Where input validation is missing, insufficient, or inconsistently applied
427
- - **Output Vulnerabilities**: Where unencoded data reaches outputs and could cause XSS/injection
428
- - **Data Leakage Risks**: Where sensitive data could be inadvertently exposed or logged
429
-
430
- **AUTHENTICATION & AUTHORIZATION ARCHITECTURE REVIEW:**
431
- - **Authentication Flow Analysis**: Complete auth workflow security across all components
432
- - **Session Management**: Session creation, validation, termination, and storage security
433
- - **Authorization Consistency**: Access control implementation across all system components
434
- - **Privilege Escalation Risks**: Both horizontal and vertical privilege escalation opportunities
435
- - **Account Management**: User creation, deletion, role management, and password security
436
-
437
- ### 5. Configuration Security Assessment
438
- - **Security Misconfigurations**: Dangerous default settings and configurations
439
- - **Environment Inconsistencies**: Security settings that vary between environments
440
- - **Secrets Management**: How API keys, passwords, and tokens are handled
441
- - **Infrastructure Security**: Server, database, and service configurations
442
-
443
- ### 6. Architectural Security Review
444
- - **Security Patterns in Use**: Well-implemented security patterns
445
- - **Security Anti-Patterns**: Problematic code patterns across the codebase
446
- - **Defense in Depth Analysis**: Multiple security layer effectiveness
447
- - **Single Points of Failure**: Where security relies on single mechanisms
448
-
449
- ### 7. Risk-Prioritized Remediation Roadmap
450
- **IMMEDIATE CRITICAL FIXES (24-48 hours):**
451
- - [Issues that could lead to immediate system compromise]
452
-
453
- **HIGH PRIORITY (1-2 weeks):**
454
- - [Cross-file vulnerabilities and architectural flaws]
455
-
456
- **MEDIUM PRIORITY (1 month):**
457
- - [Configuration improvements and security hardening]
458
-
459
- **STRATEGIC SECURITY IMPROVEMENTS (3-6 months):**
460
- - [Architectural security enhancements and process improvements]
461
-
462
- ### 8. Implementation Guidance
463
- - **Secure Development Standards**: Code standards to prevent similar issues
464
- - **Security Testing Strategy**: How to test for these vulnerability classes
465
- - **Monitoring and Detection**: Security monitoring for ongoing protection
466
- - **Developer Training Needs**: Skills gaps identified during the audit
467
-
468
- **ENTERPRISE AUDIT REQUIREMENTS:**
469
- - Focus on business-critical attack scenarios
470
- - Provide complete attack chains with proof-of-concept
471
- - Include compliance mapping to relevant standards
472
- - Emphasize systemic fixes over isolated patches
473
- - Consider threat modeling and attacker motivations
474
- - Address security at architectural and implementation levels`;
475
- return { systemAndContext, dataPayload, outputInstructions };
476
- }
477
- /**
478
- * Implement for backwards compatibility
479
- * The system still expects this method, so we intelligently route to the appropriate stages
480
- */
481
- getPromptStages(params) {
482
- const mode = this.detectAnalysisMode(params);
483
- if (mode === 'single-file') {
484
- return this.getSingleFilePromptStages(params);
485
- }
486
- else {
487
- return this.getMultiFilePromptStages(params);
488
- }
489
- }
490
- // Multi-file helper methods
491
- async discoverRelevantFiles(projectPath, maxDepth, projectType) {
492
- const extensions = this.getFileExtensions(projectType);
493
- return await this.multiFileAnalysis.discoverFiles(projectPath, extensions, maxDepth);
494
- }
495
- async performMultiFileAnalysis(files, params, model, contextLength) {
496
- const cacheKey = this.analysisCache.generateKey('security_audit', params, files);
497
- const cached = await this.analysisCache.get(cacheKey);
498
- if (cached)
499
- return cached;
500
- const fileAnalysisResults = await this.multiFileAnalysis.analyzeBatch(files, (file) => this.analyzeIndividualFile(file, params, model), contextLength);
501
- // Aggregate results into comprehensive security analysis
502
- const aggregatedResult = {
503
- summary: `Multi-file security audit of ${files.length} files`,
504
- findings: fileAnalysisResults,
505
- securityAssessment: {
506
- fileCount: files.length,
507
- totalSize: fileAnalysisResults.reduce((sum, result) => sum + (result.size || 0), 0),
508
- riskDistribution: this.categorizeFilesByRisk(fileAnalysisResults),
509
- criticalFiles: fileAnalysisResults.filter((result) => result.riskLevel === 'high'),
510
- dataFlowAnalysis: this.analyzeDataFlows(fileAnalysisResults),
511
- authenticationChain: this.analyzeAuthChain(fileAnalysisResults, params.projectType),
512
- configurationSecurity: this.analyzeConfigurations(fileAnalysisResults)
513
- }
514
- };
515
- await this.analysisCache.cacheAnalysis(cacheKey, aggregatedResult, {
516
- modelUsed: model.identifier || 'unknown',
517
- executionTime: Date.now() - Date.now(), // TODO: Track actual execution time
518
- timestamp: new Date().toISOString()
519
- });
520
- return aggregatedResult;
521
- }
522
- async analyzeIndividualFile(file, params, model) {
523
- const content = await import('fs/promises').then(fs => fs.readFile(file, 'utf-8'));
524
- const stats = await import('fs/promises').then(fs => fs.stat(file));
525
- return {
526
- filePath: file,
527
- size: content.length,
528
- lines: content.split('\n').length,
529
- extension: file.split('.').pop() || '',
530
- riskLevel: this.assessFileRisk(content, file, params.projectType),
531
- securityPatterns: this.identifySecurityPatterns(content, file),
532
- vulnerabilityIndicators: this.scanForVulnerabilities(content),
533
- modified: stats.mtime
534
- };
535
- }
536
- getFileExtensions(projectType) {
537
- const extensionMap = {
538
- 'wordpress-plugin': ['.php', '.js', '.json', '.css', '.html'],
539
- 'wordpress-theme': ['.php', '.js', '.css', '.html', '.json'],
540
- 'react-app': ['.js', '.jsx', '.ts', '.tsx', '.json', '.html', '.css'],
541
- 'react-component': ['.js', '.jsx', '.ts', '.tsx', '.css'],
542
- 'node-api': ['.js', '.ts', '.json', '.yaml', '.yml', '.env'],
543
- 'browser-extension': ['.js', '.json', '.html', '.css', '.xml'],
544
- 'cli-tool': ['.js', '.ts', '.py', '.sh', '.json'],
545
- 'n8n-node': ['.ts', '.js', '.json'],
546
- 'n8n-workflow': ['.json'],
547
- 'html-component': ['.html', '.js', '.css', '.json'],
548
- 'generic': ['.js', '.ts', '.jsx', '.tsx', '.php', '.py', '.java', '.cs', '.cpp', '.h', '.html', '.css', '.json', '.xml', '.yml', '.yaml', '.env', '.config', '.ini']
549
- };
550
- return extensionMap[projectType] || extensionMap.generic;
551
- }
552
- categorizeFilesByRisk(results) {
553
- const riskCategories = { high: 0, medium: 0, low: 0 };
554
- results.forEach(result => {
555
- riskCategories[result.riskLevel] = (riskCategories[result.riskLevel] || 0) + 1;
556
- });
557
- return riskCategories;
558
- }
559
- analyzeDataFlows(results) {
560
- // Analyze how data flows between files
561
- return {
562
- entryPoints: results.filter(r => r.securityPatterns?.includes('user-input')).length,
563
- processingFiles: results.filter(r => r.securityPatterns?.includes('data-processing')).length,
564
- outputFiles: results.filter(r => r.securityPatterns?.includes('output-generation')).length,
565
- dataFlowRisks: 'Cross-file data flow analysis would be performed here'
566
- };
567
- }
568
- analyzeAuthChain(results, projectType) {
569
- // Analyze authentication and authorization chains
570
- return {
571
- authFiles: results.filter(r => r.filePath.toLowerCase().includes('auth')).length,
572
- loginFiles: results.filter(r => r.filePath.toLowerCase().includes('login')).length,
573
- adminFiles: results.filter(r => r.filePath.toLowerCase().includes('admin')).length,
574
- authChainAnalysis: 'Authentication chain analysis would be performed here'
575
- };
576
- }
577
- analyzeConfigurations(results) {
578
- // Analyze configuration security
579
- const configFiles = results.filter(r => r.extension === 'json' ||
580
- r.extension === 'env' ||
581
- r.filePath.includes('config'));
582
- return {
583
- configFileCount: configFiles.length,
584
- configurationRisks: 'Configuration security analysis would be performed here',
585
- configFiles: configFiles.map(f => f.filePath)
586
- };
587
- }
588
- assessFileRisk(content, filePath, projectType) {
589
- // Assess individual file risk based on content patterns
590
- const riskPatterns = {
591
- high: [/eval\s*\(/i, /exec\s*\(/i, /\$_GET\s*\[/i, /\$_POST\s*\[/i, /password.*=.*['"]/i],
592
- medium: [/innerHTML\s*=/i, /document\.write/i, /api.*key/i, /secret/i],
593
- low: [/console\.log/i, /debug/i]
594
- };
595
- for (const [level, patterns] of Object.entries(riskPatterns)) {
596
- for (const pattern of patterns) {
597
- if (pattern.test(content)) {
598
- return level;
599
- }
600
- }
601
- }
602
- return 'low';
603
- }
604
- identifySecurityPatterns(content, filePath) {
605
- const patterns = [];
606
- if (/input|form|request/i.test(content))
607
- patterns.push('user-input');
608
- if (/validation|sanitize|filter/i.test(content))
609
- patterns.push('input-validation');
610
- if (/auth|login|session/i.test(content))
611
- patterns.push('authentication');
612
- if (/admin|role|permission/i.test(content))
613
- patterns.push('authorization');
614
- if (/encrypt|hash|crypto/i.test(content))
615
- patterns.push('cryptography');
616
- if (/output|echo|print|render/i.test(content))
617
- patterns.push('output-generation');
618
- return patterns;
619
- }
620
- scanForVulnerabilities(content) {
621
- const vulnerabilities = [];
622
- if (/eval\s*\(/i.test(content))
623
- vulnerabilities.push('code-injection');
624
- if (/\$_GET\s*\[.*\]\s*(?!.*htmlspecialchars)/i.test(content))
625
- vulnerabilities.push('xss-risk');
626
- if (/SELECT.*FROM.*WHERE.*\$_/i.test(content))
627
- vulnerabilities.push('sql-injection-risk');
628
- if (/password.*=.*['"]\w+['"]/i.test(content))
629
- vulnerabilities.push('hardcoded-credentials');
630
- if (/api.?key.*=.*['"]\w+['"]/i.test(content))
631
- vulnerabilities.push('hardcoded-api-key');
632
- return vulnerabilities;
633
- }
634
- generateCacheKey(files, params) {
635
- const fileHash = files.join('|');
636
- const paramHash = JSON.stringify(params);
637
- return `${fileHash}_${paramHash}`.substring(0, 64);
638
- }
639
- }
640
- export default SecurityAuditor;
641
- //# sourceMappingURL=security-audit.js.map