erosolar-cli 1.7.326 → 1.7.327

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 (323) hide show
  1. package/README.md +24 -148
  2. package/dist/bin/erosolar.js +5 -21
  3. package/dist/bin/erosolar.js.map +1 -1
  4. package/dist/capabilities/agentSpawningCapability.d.ts.map +1 -1
  5. package/dist/capabilities/agentSpawningCapability.js +56 -31
  6. package/dist/capabilities/agentSpawningCapability.js.map +1 -1
  7. package/dist/contracts/agent-schemas.json +0 -15
  8. package/dist/contracts/tools.schema.json +0 -9
  9. package/dist/core/agent.d.ts +2 -2
  10. package/dist/core/agent.d.ts.map +1 -1
  11. package/dist/core/agent.js.map +1 -1
  12. package/dist/core/customCommands.d.ts +1 -0
  13. package/dist/core/customCommands.d.ts.map +1 -1
  14. package/dist/core/customCommands.js +3 -0
  15. package/dist/core/customCommands.js.map +1 -1
  16. package/dist/core/hooks.d.ts +113 -0
  17. package/dist/core/hooks.d.ts.map +1 -0
  18. package/dist/core/hooks.js +267 -0
  19. package/dist/core/hooks.js.map +1 -0
  20. package/dist/core/metricsTracker.d.ts +122 -0
  21. package/dist/core/metricsTracker.d.ts.map +1 -0
  22. package/dist/{alpha-zero → core}/metricsTracker.js +2 -5
  23. package/dist/core/metricsTracker.js.map +1 -0
  24. package/dist/core/securityAssessment.d.ts +91 -0
  25. package/dist/core/securityAssessment.d.ts.map +1 -0
  26. package/dist/core/securityAssessment.js +580 -0
  27. package/dist/core/securityAssessment.js.map +1 -0
  28. package/dist/core/toolPreconditions.d.ts.map +1 -1
  29. package/dist/core/toolPreconditions.js +0 -14
  30. package/dist/core/toolPreconditions.js.map +1 -1
  31. package/dist/core/toolRuntime.d.ts +22 -1
  32. package/dist/core/toolRuntime.d.ts.map +1 -1
  33. package/dist/core/toolRuntime.js +0 -5
  34. package/dist/core/toolRuntime.js.map +1 -1
  35. package/dist/core/toolValidation.d.ts.map +1 -1
  36. package/dist/core/toolValidation.js +14 -3
  37. package/dist/core/toolValidation.js.map +1 -1
  38. package/dist/core/validationRunner.d.ts +1 -3
  39. package/dist/core/validationRunner.d.ts.map +1 -1
  40. package/dist/core/validationRunner.js.map +1 -1
  41. package/dist/core/verification.d.ts +137 -0
  42. package/dist/core/verification.d.ts.map +1 -0
  43. package/dist/core/verification.js +323 -0
  44. package/dist/core/verification.js.map +1 -0
  45. package/dist/headless/headlessApp.d.ts.map +1 -1
  46. package/dist/headless/headlessApp.js +21 -0
  47. package/dist/headless/headlessApp.js.map +1 -1
  48. package/dist/mcp/sseClient.d.ts.map +1 -1
  49. package/dist/mcp/sseClient.js +9 -18
  50. package/dist/mcp/sseClient.js.map +1 -1
  51. package/dist/plugins/tools/build/buildPlugin.d.ts +0 -6
  52. package/dist/plugins/tools/build/buildPlugin.d.ts.map +1 -1
  53. package/dist/plugins/tools/build/buildPlugin.js +4 -10
  54. package/dist/plugins/tools/build/buildPlugin.js.map +1 -1
  55. package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
  56. package/dist/plugins/tools/nodeDefaults.js +0 -2
  57. package/dist/plugins/tools/nodeDefaults.js.map +1 -1
  58. package/dist/runtime/agentSession.d.ts +2 -2
  59. package/dist/runtime/agentSession.d.ts.map +1 -1
  60. package/dist/runtime/agentSession.js +2 -2
  61. package/dist/runtime/agentSession.js.map +1 -1
  62. package/dist/shell/interactiveShell.d.ts +16 -7
  63. package/dist/shell/interactiveShell.d.ts.map +1 -1
  64. package/dist/shell/interactiveShell.js +235 -164
  65. package/dist/shell/interactiveShell.js.map +1 -1
  66. package/dist/shell/shellApp.d.ts +2 -0
  67. package/dist/shell/shellApp.d.ts.map +1 -1
  68. package/dist/shell/shellApp.js +40 -9
  69. package/dist/shell/shellApp.js.map +1 -1
  70. package/dist/shell/systemPrompt.d.ts.map +1 -1
  71. package/dist/shell/systemPrompt.js +1 -4
  72. package/dist/shell/systemPrompt.js.map +1 -1
  73. package/dist/shell/terminalInput.d.ts +149 -116
  74. package/dist/shell/terminalInput.d.ts.map +1 -1
  75. package/dist/shell/terminalInput.js +639 -521
  76. package/dist/shell/terminalInput.js.map +1 -1
  77. package/dist/shell/terminalInputAdapter.d.ts +79 -20
  78. package/dist/shell/terminalInputAdapter.d.ts.map +1 -1
  79. package/dist/shell/terminalInputAdapter.js +99 -30
  80. package/dist/shell/terminalInputAdapter.js.map +1 -1
  81. package/dist/subagents/agentConfig.d.ts +27 -0
  82. package/dist/subagents/agentConfig.d.ts.map +1 -0
  83. package/dist/subagents/agentConfig.js +89 -0
  84. package/dist/subagents/agentConfig.js.map +1 -0
  85. package/dist/subagents/agentRegistry.d.ts +33 -0
  86. package/dist/subagents/agentRegistry.d.ts.map +1 -0
  87. package/dist/subagents/agentRegistry.js +162 -0
  88. package/dist/subagents/agentRegistry.js.map +1 -0
  89. package/dist/subagents/taskRunner.d.ts +7 -1
  90. package/dist/subagents/taskRunner.d.ts.map +1 -1
  91. package/dist/subagents/taskRunner.js +180 -47
  92. package/dist/subagents/taskRunner.js.map +1 -1
  93. package/dist/ui/ShellUIAdapter.d.ts.map +1 -1
  94. package/dist/ui/ShellUIAdapter.js +13 -12
  95. package/dist/ui/ShellUIAdapter.js.map +1 -1
  96. package/dist/ui/display.d.ts +24 -45
  97. package/dist/ui/display.d.ts.map +1 -1
  98. package/dist/ui/display.js +140 -259
  99. package/dist/ui/display.js.map +1 -1
  100. package/dist/ui/theme.d.ts.map +1 -1
  101. package/dist/ui/theme.js +6 -8
  102. package/dist/ui/theme.js.map +1 -1
  103. package/dist/ui/toolDisplay.d.ts +0 -158
  104. package/dist/ui/toolDisplay.d.ts.map +1 -1
  105. package/dist/ui/toolDisplay.js +0 -348
  106. package/dist/ui/toolDisplay.js.map +1 -1
  107. package/dist/ui/unified/layout.d.ts +1 -0
  108. package/dist/ui/unified/layout.d.ts.map +1 -1
  109. package/dist/ui/unified/layout.js +15 -25
  110. package/dist/ui/unified/layout.js.map +1 -1
  111. package/dist/utils/frontmatter.d.ts +10 -0
  112. package/dist/utils/frontmatter.d.ts.map +1 -0
  113. package/dist/utils/frontmatter.js +78 -0
  114. package/dist/utils/frontmatter.js.map +1 -0
  115. package/package.json +4 -4
  116. package/dist/alpha-zero/agentWrapper.d.ts +0 -84
  117. package/dist/alpha-zero/agentWrapper.d.ts.map +0 -1
  118. package/dist/alpha-zero/agentWrapper.js +0 -171
  119. package/dist/alpha-zero/agentWrapper.js.map +0 -1
  120. package/dist/alpha-zero/codeEvaluator.d.ts +0 -25
  121. package/dist/alpha-zero/codeEvaluator.d.ts.map +0 -1
  122. package/dist/alpha-zero/codeEvaluator.js +0 -273
  123. package/dist/alpha-zero/codeEvaluator.js.map +0 -1
  124. package/dist/alpha-zero/competitiveRunner.d.ts +0 -66
  125. package/dist/alpha-zero/competitiveRunner.d.ts.map +0 -1
  126. package/dist/alpha-zero/competitiveRunner.js +0 -224
  127. package/dist/alpha-zero/competitiveRunner.js.map +0 -1
  128. package/dist/alpha-zero/index.d.ts +0 -67
  129. package/dist/alpha-zero/index.d.ts.map +0 -1
  130. package/dist/alpha-zero/index.js +0 -99
  131. package/dist/alpha-zero/index.js.map +0 -1
  132. package/dist/alpha-zero/introspection.d.ts +0 -128
  133. package/dist/alpha-zero/introspection.d.ts.map +0 -1
  134. package/dist/alpha-zero/introspection.js +0 -300
  135. package/dist/alpha-zero/introspection.js.map +0 -1
  136. package/dist/alpha-zero/metricsTracker.d.ts +0 -71
  137. package/dist/alpha-zero/metricsTracker.d.ts.map +0 -1
  138. package/dist/alpha-zero/metricsTracker.js.map +0 -1
  139. package/dist/alpha-zero/security/core.d.ts +0 -125
  140. package/dist/alpha-zero/security/core.d.ts.map +0 -1
  141. package/dist/alpha-zero/security/core.js +0 -271
  142. package/dist/alpha-zero/security/core.js.map +0 -1
  143. package/dist/alpha-zero/security/google.d.ts +0 -125
  144. package/dist/alpha-zero/security/google.d.ts.map +0 -1
  145. package/dist/alpha-zero/security/google.js +0 -311
  146. package/dist/alpha-zero/security/google.js.map +0 -1
  147. package/dist/alpha-zero/security/googleLoader.d.ts +0 -17
  148. package/dist/alpha-zero/security/googleLoader.d.ts.map +0 -1
  149. package/dist/alpha-zero/security/googleLoader.js +0 -41
  150. package/dist/alpha-zero/security/googleLoader.js.map +0 -1
  151. package/dist/alpha-zero/security/index.d.ts +0 -29
  152. package/dist/alpha-zero/security/index.d.ts.map +0 -1
  153. package/dist/alpha-zero/security/index.js +0 -32
  154. package/dist/alpha-zero/security/index.js.map +0 -1
  155. package/dist/alpha-zero/security/simulation.d.ts +0 -124
  156. package/dist/alpha-zero/security/simulation.d.ts.map +0 -1
  157. package/dist/alpha-zero/security/simulation.js +0 -277
  158. package/dist/alpha-zero/security/simulation.js.map +0 -1
  159. package/dist/alpha-zero/selfModification.d.ts +0 -109
  160. package/dist/alpha-zero/selfModification.d.ts.map +0 -1
  161. package/dist/alpha-zero/selfModification.js +0 -233
  162. package/dist/alpha-zero/selfModification.js.map +0 -1
  163. package/dist/alpha-zero/types.d.ts +0 -170
  164. package/dist/alpha-zero/types.d.ts.map +0 -1
  165. package/dist/alpha-zero/types.js +0 -31
  166. package/dist/alpha-zero/types.js.map +0 -1
  167. package/dist/capabilities/securityTestingCapability.d.ts +0 -13
  168. package/dist/capabilities/securityTestingCapability.d.ts.map +0 -1
  169. package/dist/capabilities/securityTestingCapability.js +0 -25
  170. package/dist/capabilities/securityTestingCapability.js.map +0 -1
  171. package/dist/core/aiFlowOptimizer.d.ts +0 -26
  172. package/dist/core/aiFlowOptimizer.d.ts.map +0 -1
  173. package/dist/core/aiFlowOptimizer.js +0 -31
  174. package/dist/core/aiFlowOptimizer.js.map +0 -1
  175. package/dist/core/aiOptimizationEngine.d.ts +0 -158
  176. package/dist/core/aiOptimizationEngine.d.ts.map +0 -1
  177. package/dist/core/aiOptimizationEngine.js +0 -428
  178. package/dist/core/aiOptimizationEngine.js.map +0 -1
  179. package/dist/core/aiOptimizationIntegration.d.ts +0 -93
  180. package/dist/core/aiOptimizationIntegration.d.ts.map +0 -1
  181. package/dist/core/aiOptimizationIntegration.js +0 -250
  182. package/dist/core/aiOptimizationIntegration.js.map +0 -1
  183. package/dist/core/enhancedErrorRecovery.d.ts +0 -100
  184. package/dist/core/enhancedErrorRecovery.d.ts.map +0 -1
  185. package/dist/core/enhancedErrorRecovery.js +0 -345
  186. package/dist/core/enhancedErrorRecovery.js.map +0 -1
  187. package/dist/core/hooksSystem.d.ts +0 -65
  188. package/dist/core/hooksSystem.d.ts.map +0 -1
  189. package/dist/core/hooksSystem.js +0 -273
  190. package/dist/core/hooksSystem.js.map +0 -1
  191. package/dist/core/memorySystem.d.ts +0 -48
  192. package/dist/core/memorySystem.d.ts.map +0 -1
  193. package/dist/core/memorySystem.js +0 -271
  194. package/dist/core/memorySystem.js.map +0 -1
  195. package/dist/core/unified/errors.d.ts +0 -189
  196. package/dist/core/unified/errors.d.ts.map +0 -1
  197. package/dist/core/unified/errors.js +0 -497
  198. package/dist/core/unified/errors.js.map +0 -1
  199. package/dist/core/unified/index.d.ts +0 -19
  200. package/dist/core/unified/index.d.ts.map +0 -1
  201. package/dist/core/unified/index.js +0 -68
  202. package/dist/core/unified/index.js.map +0 -1
  203. package/dist/core/unified/schema.d.ts +0 -101
  204. package/dist/core/unified/schema.d.ts.map +0 -1
  205. package/dist/core/unified/schema.js +0 -350
  206. package/dist/core/unified/schema.js.map +0 -1
  207. package/dist/core/unified/toolRuntime.d.ts +0 -179
  208. package/dist/core/unified/toolRuntime.d.ts.map +0 -1
  209. package/dist/core/unified/toolRuntime.js +0 -517
  210. package/dist/core/unified/toolRuntime.js.map +0 -1
  211. package/dist/core/unified/tools.d.ts +0 -127
  212. package/dist/core/unified/tools.d.ts.map +0 -1
  213. package/dist/core/unified/tools.js +0 -1333
  214. package/dist/core/unified/tools.js.map +0 -1
  215. package/dist/core/unified/types.d.ts +0 -352
  216. package/dist/core/unified/types.d.ts.map +0 -1
  217. package/dist/core/unified/types.js +0 -12
  218. package/dist/core/unified/types.js.map +0 -1
  219. package/dist/core/unified/version.d.ts +0 -209
  220. package/dist/core/unified/version.d.ts.map +0 -1
  221. package/dist/core/unified/version.js +0 -454
  222. package/dist/core/unified/version.js.map +0 -1
  223. package/dist/plugins/tools/security/securityPlugin.d.ts +0 -3
  224. package/dist/plugins/tools/security/securityPlugin.d.ts.map +0 -1
  225. package/dist/plugins/tools/security/securityPlugin.js +0 -12
  226. package/dist/plugins/tools/security/securityPlugin.js.map +0 -1
  227. package/dist/security/active-stack-security.d.ts +0 -112
  228. package/dist/security/active-stack-security.d.ts.map +0 -1
  229. package/dist/security/active-stack-security.js +0 -296
  230. package/dist/security/active-stack-security.js.map +0 -1
  231. package/dist/security/advanced-persistence-research.d.ts +0 -92
  232. package/dist/security/advanced-persistence-research.d.ts.map +0 -1
  233. package/dist/security/advanced-persistence-research.js +0 -195
  234. package/dist/security/advanced-persistence-research.js.map +0 -1
  235. package/dist/security/advanced-targeting.d.ts +0 -119
  236. package/dist/security/advanced-targeting.d.ts.map +0 -1
  237. package/dist/security/advanced-targeting.js +0 -233
  238. package/dist/security/advanced-targeting.js.map +0 -1
  239. package/dist/security/assessment/vulnerabilityAssessment.d.ts +0 -104
  240. package/dist/security/assessment/vulnerabilityAssessment.d.ts.map +0 -1
  241. package/dist/security/assessment/vulnerabilityAssessment.js +0 -315
  242. package/dist/security/assessment/vulnerabilityAssessment.js.map +0 -1
  243. package/dist/security/authorization/securityAuthorization.d.ts +0 -88
  244. package/dist/security/authorization/securityAuthorization.d.ts.map +0 -1
  245. package/dist/security/authorization/securityAuthorization.js +0 -172
  246. package/dist/security/authorization/securityAuthorization.js.map +0 -1
  247. package/dist/security/comprehensive-targeting.d.ts +0 -85
  248. package/dist/security/comprehensive-targeting.d.ts.map +0 -1
  249. package/dist/security/comprehensive-targeting.js +0 -438
  250. package/dist/security/comprehensive-targeting.js.map +0 -1
  251. package/dist/security/global-security-integration.d.ts +0 -91
  252. package/dist/security/global-security-integration.d.ts.map +0 -1
  253. package/dist/security/global-security-integration.js +0 -218
  254. package/dist/security/global-security-integration.js.map +0 -1
  255. package/dist/security/index.d.ts +0 -38
  256. package/dist/security/index.d.ts.map +0 -1
  257. package/dist/security/index.js +0 -47
  258. package/dist/security/index.js.map +0 -1
  259. package/dist/security/persistence-analyzer.d.ts +0 -56
  260. package/dist/security/persistence-analyzer.d.ts.map +0 -1
  261. package/dist/security/persistence-analyzer.js +0 -187
  262. package/dist/security/persistence-analyzer.js.map +0 -1
  263. package/dist/security/persistence-cli.d.ts +0 -36
  264. package/dist/security/persistence-cli.d.ts.map +0 -1
  265. package/dist/security/persistence-cli.js +0 -160
  266. package/dist/security/persistence-cli.js.map +0 -1
  267. package/dist/security/persistence-research.d.ts +0 -92
  268. package/dist/security/persistence-research.d.ts.map +0 -1
  269. package/dist/security/persistence-research.js +0 -364
  270. package/dist/security/persistence-research.js.map +0 -1
  271. package/dist/security/research/persistenceResearch.d.ts +0 -97
  272. package/dist/security/research/persistenceResearch.d.ts.map +0 -1
  273. package/dist/security/research/persistenceResearch.js +0 -282
  274. package/dist/security/research/persistenceResearch.js.map +0 -1
  275. package/dist/security/security-integration.d.ts +0 -74
  276. package/dist/security/security-integration.d.ts.map +0 -1
  277. package/dist/security/security-integration.js +0 -137
  278. package/dist/security/security-integration.js.map +0 -1
  279. package/dist/security/security-testing-framework.d.ts +0 -112
  280. package/dist/security/security-testing-framework.d.ts.map +0 -1
  281. package/dist/security/security-testing-framework.js +0 -364
  282. package/dist/security/security-testing-framework.js.map +0 -1
  283. package/dist/security/simulation/attackSimulation.d.ts +0 -93
  284. package/dist/security/simulation/attackSimulation.d.ts.map +0 -1
  285. package/dist/security/simulation/attackSimulation.js +0 -341
  286. package/dist/security/simulation/attackSimulation.js.map +0 -1
  287. package/dist/security/strategic-operations.d.ts +0 -100
  288. package/dist/security/strategic-operations.d.ts.map +0 -1
  289. package/dist/security/strategic-operations.js +0 -276
  290. package/dist/security/strategic-operations.js.map +0 -1
  291. package/dist/security/tool-security-wrapper.d.ts +0 -58
  292. package/dist/security/tool-security-wrapper.d.ts.map +0 -1
  293. package/dist/security/tool-security-wrapper.js +0 -156
  294. package/dist/security/tool-security-wrapper.js.map +0 -1
  295. package/dist/shell/claudeCodeStreamHandler.d.ts +0 -145
  296. package/dist/shell/claudeCodeStreamHandler.d.ts.map +0 -1
  297. package/dist/shell/claudeCodeStreamHandler.js +0 -322
  298. package/dist/shell/claudeCodeStreamHandler.js.map +0 -1
  299. package/dist/shell/inputQueueManager.d.ts +0 -144
  300. package/dist/shell/inputQueueManager.d.ts.map +0 -1
  301. package/dist/shell/inputQueueManager.js +0 -290
  302. package/dist/shell/inputQueueManager.js.map +0 -1
  303. package/dist/shell/metricsTracker.d.ts +0 -60
  304. package/dist/shell/metricsTracker.d.ts.map +0 -1
  305. package/dist/shell/metricsTracker.js +0 -119
  306. package/dist/shell/metricsTracker.js.map +0 -1
  307. package/dist/shell/streamingOutputManager.d.ts +0 -115
  308. package/dist/shell/streamingOutputManager.d.ts.map +0 -1
  309. package/dist/shell/streamingOutputManager.js +0 -225
  310. package/dist/shell/streamingOutputManager.js.map +0 -1
  311. package/dist/tools/securityTools.d.ts +0 -22
  312. package/dist/tools/securityTools.d.ts.map +0 -1
  313. package/dist/tools/securityTools.js +0 -448
  314. package/dist/tools/securityTools.js.map +0 -1
  315. package/dist/ui/persistentPrompt.d.ts +0 -50
  316. package/dist/ui/persistentPrompt.d.ts.map +0 -1
  317. package/dist/ui/persistentPrompt.js +0 -92
  318. package/dist/ui/persistentPrompt.js.map +0 -1
  319. package/dist/ui/terminalUISchema.d.ts +0 -195
  320. package/dist/ui/terminalUISchema.d.ts.map +0 -1
  321. package/dist/ui/terminalUISchema.js +0 -113
  322. package/dist/ui/terminalUISchema.js.map +0 -1
  323. package/scripts/deploy-security-capabilities.js +0 -178
@@ -1,315 +0,0 @@
1
- /**
2
- * Vulnerability Assessment Engine
3
- *
4
- * Provides vulnerability scanning and risk assessment capabilities
5
- * for authorized security research and testing.
6
- *
7
- * LEGAL NOTICE:
8
- * For authorized security research, penetration testing, and red team exercises only.
9
- */
10
- /**
11
- * Vulnerability Assessment Engine
12
- */
13
- export class VulnerabilityAssessmentEngine {
14
- vulnerabilityDatabase;
15
- constructor() {
16
- this.vulnerabilityDatabase = new Map();
17
- this.initializeVulnerabilityDatabase();
18
- }
19
- /**
20
- * Scan for vulnerabilities
21
- */
22
- async scanVulnerabilities(request) {
23
- // In a real implementation, this would perform actual scanning
24
- // For demonstration, we return simulated results
25
- const vulnerabilities = this.generateSimulatedVulnerabilities(request);
26
- const summary = this.calculateVulnerabilitySummary(vulnerabilities);
27
- return {
28
- targetType: request.targetType,
29
- targetUrl: request.targetUrl,
30
- scanDepth: request.scanDepth,
31
- scanDate: new Date().toISOString(),
32
- vulnerabilities,
33
- summary
34
- };
35
- }
36
- /**
37
- * Assess security risks
38
- */
39
- async assessRisk(request) {
40
- const riskScore = this.calculateRiskScore(request.findings, request.context);
41
- const riskLevel = this.determineRiskLevel(riskScore);
42
- const recommendations = this.generateRiskRecommendations(request.findings, riskLevel);
43
- const priorityActions = this.generatePriorityActions(riskLevel);
44
- return {
45
- findings: request.findings,
46
- context: request.context,
47
- riskScore,
48
- riskLevel,
49
- recommendations,
50
- priorityActions
51
- };
52
- }
53
- /**
54
- * Get vulnerability by ID
55
- */
56
- getVulnerability(vulnerabilityId) {
57
- return this.vulnerabilityDatabase.get(vulnerabilityId);
58
- }
59
- /**
60
- * List all vulnerabilities
61
- */
62
- listVulnerabilities() {
63
- return Array.from(this.vulnerabilityDatabase.values());
64
- }
65
- /**
66
- * Generate simulated vulnerabilities for demonstration
67
- */
68
- generateSimulatedVulnerabilities(request) {
69
- const vulnerabilities = [];
70
- // Common web application vulnerabilities
71
- if (request.targetType === 'web_application') {
72
- vulnerabilities.push({
73
- id: 'sql-injection',
74
- name: 'SQL Injection',
75
- severity: 'high',
76
- category: 'injection',
77
- description: 'Application is vulnerable to SQL injection attacks',
78
- impact: 'Potential database compromise and data exfiltration',
79
- remediation: 'Implement parameterized queries and input validation',
80
- cvssScore: 8.5,
81
- references: ['https://owasp.org/www-community/attacks/SQL_Injection']
82
- }, {
83
- id: 'xss',
84
- name: 'Cross-Site Scripting',
85
- severity: 'medium',
86
- category: 'client-side',
87
- description: 'Application does not properly sanitize user input',
88
- impact: 'Session hijacking and client-side code execution',
89
- remediation: 'Implement proper input sanitization and output encoding',
90
- cvssScore: 6.1,
91
- references: ['https://owasp.org/www-community/attacks/xss/']
92
- });
93
- }
94
- // API vulnerabilities
95
- if (request.targetType === 'api') {
96
- vulnerabilities.push({
97
- id: 'broken-auth',
98
- name: 'Broken Authentication',
99
- severity: 'high',
100
- category: 'authentication',
101
- description: 'API authentication mechanisms are weak or broken',
102
- impact: 'Unauthorized access to sensitive data and functionality',
103
- remediation: 'Implement strong authentication and session management',
104
- cvssScore: 8.2,
105
- references: ['https://owasp.org/www-project-api-security/']
106
- });
107
- }
108
- // Infrastructure vulnerabilities
109
- if (request.targetType === 'infrastructure') {
110
- vulnerabilities.push({
111
- id: 'weak-ssh',
112
- name: 'Weak SSH Configuration',
113
- severity: 'medium',
114
- category: 'configuration',
115
- description: 'SSH service allows weak authentication methods',
116
- impact: 'Potential unauthorized system access',
117
- remediation: 'Disable weak ciphers and enforce key-based authentication',
118
- cvssScore: 5.9
119
- });
120
- }
121
- // Adjust based on scan depth
122
- if (request.scanDepth === 'quick') {
123
- return vulnerabilities.slice(0, 2);
124
- }
125
- else if (request.scanDepth === 'standard') {
126
- return vulnerabilities;
127
- }
128
- else {
129
- // Deep scan - add more vulnerabilities
130
- vulnerabilities.push({
131
- id: 'info-leak',
132
- name: 'Information Disclosure',
133
- severity: 'low',
134
- category: 'information',
135
- description: 'Application discloses sensitive information in error messages',
136
- impact: 'Information leakage that could aid attackers',
137
- remediation: 'Implement proper error handling and information disclosure controls',
138
- cvssScore: 3.5
139
- });
140
- return vulnerabilities;
141
- }
142
- }
143
- /**
144
- * Calculate vulnerability summary
145
- */
146
- calculateVulnerabilitySummary(vulnerabilities) {
147
- const severityWeights = {
148
- critical: 10,
149
- high: 7,
150
- medium: 4,
151
- low: 1,
152
- info: 0
153
- };
154
- let criticalCount = 0;
155
- let highCount = 0;
156
- let mediumCount = 0;
157
- let lowCount = 0;
158
- let totalWeight = 0;
159
- for (const vuln of vulnerabilities) {
160
- switch (vuln.severity) {
161
- case 'critical':
162
- criticalCount++;
163
- totalWeight += severityWeights.critical;
164
- break;
165
- case 'high':
166
- highCount++;
167
- totalWeight += severityWeights.high;
168
- break;
169
- case 'medium':
170
- mediumCount++;
171
- totalWeight += severityWeights.medium;
172
- break;
173
- case 'low':
174
- lowCount++;
175
- totalWeight += severityWeights.low;
176
- break;
177
- }
178
- }
179
- const maxPossibleWeight = vulnerabilities.length * severityWeights.critical;
180
- const riskScore = maxPossibleWeight > 0 ? (totalWeight / maxPossibleWeight) * 10 : 0;
181
- return {
182
- totalVulnerabilities: vulnerabilities.length,
183
- criticalCount,
184
- highCount,
185
- mediumCount,
186
- lowCount,
187
- riskScore: Math.round(riskScore * 10) / 10
188
- };
189
- }
190
- /**
191
- * Calculate risk score
192
- */
193
- calculateRiskScore(findings, context) {
194
- let baseScore = 0;
195
- // Context multiplier
196
- const contextMultipliers = {
197
- 'production': 1.5,
198
- 'staging': 1.0,
199
- 'development': 0.5,
200
- 'test': 0.3
201
- };
202
- const contextMultiplier = contextMultipliers[context] || 1.0;
203
- // Analyze findings
204
- for (const finding of findings) {
205
- const findingLower = finding.toLowerCase();
206
- if (findingLower.includes('critical') || findingLower.includes('high risk')) {
207
- baseScore += 8;
208
- }
209
- else if (findingLower.includes('medium') || findingLower.includes('moderate')) {
210
- baseScore += 5;
211
- }
212
- else if (findingLower.includes('low')) {
213
- baseScore += 2;
214
- }
215
- else {
216
- baseScore += 1;
217
- }
218
- // Additional risk factors
219
- if (findingLower.includes('data') && findingLower.includes('exposure')) {
220
- baseScore += 3;
221
- }
222
- if (findingLower.includes('authentication') && findingLower.includes('bypass')) {
223
- baseScore += 4;
224
- }
225
- if (findingLower.includes('remote') && findingLower.includes('code')) {
226
- baseScore += 6;
227
- }
228
- }
229
- return Math.min(10, (baseScore / Math.max(1, findings.length)) * contextMultiplier);
230
- }
231
- /**
232
- * Determine risk level
233
- */
234
- determineRiskLevel(riskScore) {
235
- if (riskScore >= 8)
236
- return 'critical';
237
- if (riskScore >= 6)
238
- return 'high';
239
- if (riskScore >= 4)
240
- return 'medium';
241
- return 'low';
242
- }
243
- /**
244
- * Generate risk recommendations
245
- */
246
- generateRiskRecommendations(findings, riskLevel) {
247
- const recommendations = [];
248
- recommendations.push(`Address ${riskLevel} risk findings immediately`);
249
- if (findings.some(f => f.toLowerCase().includes('injection'))) {
250
- recommendations.push('Implement input validation and parameterized queries');
251
- }
252
- if (findings.some(f => f.toLowerCase().includes('authentication'))) {
253
- recommendations.push('Strengthen authentication mechanisms and session management');
254
- }
255
- if (findings.some(f => f.toLowerCase().includes('data'))) {
256
- recommendations.push('Implement data protection and encryption controls');
257
- }
258
- recommendations.push('Conduct regular security assessments', 'Implement security monitoring and alerting', 'Provide security awareness training');
259
- return recommendations;
260
- }
261
- /**
262
- * Generate priority actions
263
- */
264
- generatePriorityActions(riskLevel) {
265
- const actions = [];
266
- switch (riskLevel) {
267
- case 'critical':
268
- actions.push('Immediate remediation required', 'Consider temporary service suspension', 'Engage incident response team');
269
- break;
270
- case 'high':
271
- actions.push('Remediate within 24-48 hours', 'Implement compensating controls', 'Increase monitoring and alerting');
272
- break;
273
- case 'medium':
274
- actions.push('Remediate within 1-2 weeks', 'Schedule security review', 'Update risk assessment');
275
- break;
276
- case 'low':
277
- actions.push('Address in next development cycle', 'Document for future reference', 'Monitor for changes in risk level');
278
- break;
279
- }
280
- return actions;
281
- }
282
- /**
283
- * Initialize vulnerability database
284
- */
285
- initializeVulnerabilityDatabase() {
286
- // This would be populated with real vulnerability data
287
- // For demonstration, we use a minimal set
288
- const vulnerabilities = [
289
- {
290
- id: 'sql-injection',
291
- name: 'SQL Injection',
292
- severity: 'high',
293
- category: 'injection',
294
- description: 'Application is vulnerable to SQL injection attacks',
295
- impact: 'Potential database compromise and data exfiltration',
296
- remediation: 'Implement parameterized queries and input validation',
297
- cvssScore: 8.5
298
- },
299
- {
300
- id: 'xss',
301
- name: 'Cross-Site Scripting',
302
- severity: 'medium',
303
- category: 'client-side',
304
- description: 'Application does not properly sanitize user input',
305
- impact: 'Session hijacking and client-side code execution',
306
- remediation: 'Implement proper input sanitization and output encoding',
307
- cvssScore: 6.1
308
- }
309
- ];
310
- for (const vuln of vulnerabilities) {
311
- this.vulnerabilityDatabase.set(vuln.id, vuln);
312
- }
313
- }
314
- }
315
- //# sourceMappingURL=vulnerabilityAssessment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vulnerabilityAssessment.js","sourceRoot":"","sources":["../../../src/security/assessment/vulnerabilityAssessment.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkDH;;GAEG;AACH,MAAM,OAAO,6BAA6B;IAChC,qBAAqB,CAA6B;IAE1D;QACE,IAAI,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QACvC,IAAI,CAAC,+BAA+B,EAAE,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CAAC,OAAiC;QACzD,+DAA+D;QAC/D,iDAAiD;QACjD,MAAM,eAAe,GAAG,IAAI,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC;QAEvE,MAAM,OAAO,GAAG,IAAI,CAAC,6BAA6B,CAAC,eAAe,CAAC,CAAC;QAEpE,OAAO;YACL,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAClC,eAAe;YACf,OAAO;SACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,OAA8B;QAC7C,MAAM,SA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EAAE,eAAe;gBACrB,QAAQ,EAAE,MAAM;gBAChB,QAAQ,EAAE,WAAW;gBACrB,WAAW,EAAE,oDAAoD;gBACjE,MAAM,EAAE,qDAAqD;gBAC7D,WAAW,EAAE,sDAAsD;gBACnE,SAAS,EAAE,GAAG;aACf;YACD;gBACE,EAAE,EAAE,KAAK;gBACT,IAAI,EAAE,sBAAsB;gBAC5B,QAAQ,EAAE,QAAQ;gBAClB,QAAQ,EAAE,aAAa;gBACvB,WAAW,EAAE,mDAAmD;gBAChE,MAAM,EAAE,kDAAkD;gBAC1D,WAAW,EAAE,yDAAyD;gBACtE,SAAS,EAAE,GAAG;aACf;SACF,CAAC;QAEF,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;YACnC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF"}
@@ -1,88 +0,0 @@
1
- /**
2
- * Security Authorization Engine
3
- *
4
- * Manages authorization and scope validation for security research activities.
5
- * Ensures all security testing is properly authorized and within defined scope.
6
- *
7
- * LEGAL NOTICE:
8
- * All security research must be properly authorized and scoped.
9
- * Unauthorized security testing is illegal and unethical.
10
- */
11
- export interface AuthorizationRequest {
12
- authorizationType: 'bug_bounty' | 'pentest' | 'red_team' | 'ctf' | 'educational';
13
- targetDomain: string;
14
- authorizedBy: string;
15
- scopeLimitations?: string[];
16
- outOfScope?: string[];
17
- expirationDate?: string;
18
- }
19
- export interface AuthorizationRecord {
20
- authorizationType: string;
21
- targetDomain: string;
22
- authorizedBy: string;
23
- scopeLimitations: string[];
24
- outOfScope: string[];
25
- authorizationDate: string;
26
- expirationDate?: string;
27
- status: 'authorized' | 'pending' | 'revoked';
28
- authorizationId: string;
29
- }
30
- export interface ScopeValidationRequest {
31
- activity: string;
32
- target: string;
33
- }
34
- export interface ScopeValidationResult {
35
- activity: string;
36
- target: string;
37
- valid: boolean;
38
- reason?: string;
39
- scopeCheck: string;
40
- }
41
- /**
42
- * Security Authorization Engine
43
- */
44
- export declare class SecurityAuthorizationEngine {
45
- private authorizations;
46
- constructor();
47
- /**
48
- * Create security research authorization
49
- */
50
- createAuthorization(request: AuthorizationRequest): Promise<AuthorizationRecord>;
51
- /**
52
- * Validate if an activity is within authorized scope
53
- */
54
- validateScope(request: ScopeValidationRequest): Promise<ScopeValidationResult>;
55
- /**
56
- * Get authorization by ID
57
- */
58
- getAuthorization(authorizationId: string): AuthorizationRecord | undefined;
59
- /**
60
- * List all authorizations
61
- */
62
- listAuthorizations(): AuthorizationRecord[];
63
- /**
64
- * Revoke authorization
65
- */
66
- revokeAuthorization(authorizationId: string): boolean;
67
- /**
68
- * Generate unique authorization ID
69
- */
70
- private generateAuthorizationId;
71
- /**
72
- * Find relevant authorization for target
73
- */
74
- private findRelevantAuthorization;
75
- /**
76
- * Check if activity is out of scope
77
- */
78
- private isActivityOutOfScope;
79
- /**
80
- * Check scope limitations
81
- */
82
- private checkScopeLimitations;
83
- /**
84
- * Check if activity is potentially destructive
85
- */
86
- private isDestructiveActivity;
87
- }
88
- //# sourceMappingURL=securityAuthorization.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"securityAuthorization.d.ts","sourceRoot":"","sources":["../../../src/security/authorization/securityAuthorization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,oBAAoB;IACnC,iBAAiB,EAAE,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,aAAa,CAAC;IACjF,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;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
4
- * Manages authorization and scope validation for security research activities.
5
- * Ensures all security testing is properly authorized and within defined scope.
6
- *
7
- * LEGAL NOTICE:
8
- * All security research must be properly authorized and scoped.
9
- * Unauthorized security testing is illegal and unethical.
10
- */
11
- /**
12
- * Security Authorization Engine
13
- */
14
- export class SecurityAuthorizationEngine {
15
- authorizations;
16
- constructor() {
17
- this.authorizations = new Map();
18
- }
19
- /**
20
- * Create security research authorization
21
- */
22
- async createAuthorization(request) {
23
- const authorization = {
24
- authorizationType: request.authorizationType,
25
- targetDomain: request.targetDomain,
26
- authorizedBy: request.authorizedBy,
27
- scopeLimitations: request.scopeLimitations || [],
28
- outOfScope: request.outOfScope || [],
29
- authorizationDate: new Date().toISOString(),
30
- expirationDate: request.expirationDate,
31
- status: 'authorized',
32
- authorizationId: this.generateAuthorizationId()
33
- };
34
- this.authorizations.set(authorization.authorizationId, authorization);
35
- return authorization;
36
- }
37
- /**
38
- * Validate if an activity is within authorized scope
39
- */
40
- async validateScope(request) {
41
- // Find relevant authorization
42
- const authorization = this.findRelevantAuthorization(request.target);
43
- if (!authorization) {
44
- return {
45
- activity: request.activity,
46
- target: request.target,
47
- valid: false,
48
- reason: 'No authorization found for target',
49
- scopeCheck: 'Manual validation required - no authorization record found'
50
- };
51
- }
52
- // Check if authorization is still valid
53
- if (authorization.expirationDate && new Date(authorization.expirationDate) < new Date()) {
54
- return {
55
- activity: request.activity,
56
- target: request.target,
57
- valid: false,
58
- reason: 'Authorization has expired',
59
- scopeCheck: 'Authorization expired - renew authorization before proceeding'
60
- };
61
- }
62
- // Check if activity is explicitly out of scope
63
- const isOutOfScope = this.isActivityOutOfScope(request.activity, authorization.outOfScope);
64
- if (isOutOfScope) {
65
- return {
66
- activity: request.activity,
67
- target: request.target,
68
- valid: false,
69
- reason: 'Activity is explicitly out of scope',
70
- scopeCheck: 'Activity prohibited - explicitly listed as out of scope'
71
- };
72
- }
73
- // Check scope limitations
74
- const scopeViolation = this.checkScopeLimitations(request.activity, authorization.scopeLimitations);
75
- if (scopeViolation) {
76
- return {
77
- activity: request.activity,
78
- target: request.target,
79
- valid: false,
80
- reason: scopeViolation,
81
- scopeCheck: 'Scope limitation violation - review authorization scope'
82
- };
83
- }
84
- return {
85
- activity: request.activity,
86
- target: request.target,
87
- valid: true,
88
- scopeCheck: 'Activity appears to be within authorized scope - proceed with caution'
89
- };
90
- }
91
- /**
92
- * Get authorization by ID
93
- */
94
- getAuthorization(authorizationId) {
95
- return this.authorizations.get(authorizationId);
96
- }
97
- /**
98
- * List all authorizations
99
- */
100
- listAuthorizations() {
101
- return Array.from(this.authorizations.values());
102
- }
103
- /**
104
- * Revoke authorization
105
- */
106
- revokeAuthorization(authorizationId) {
107
- const authorization = this.authorizations.get(authorizationId);
108
- if (authorization) {
109
- authorization.status = 'revoked';
110
- return true;
111
- }
112
- return false;
113
- }
114
- /**
115
- * Generate unique authorization ID
116
- */
117
- generateAuthorizationId() {
118
- return `auth_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
119
- }
120
- /**
121
- * Find relevant authorization for target
122
- */
123
- findRelevantAuthorization(target) {
124
- for (const authorization of this.authorizations.values()) {
125
- if (authorization.status !== 'authorized')
126
- continue;
127
- // Simple domain matching - in real implementation, use proper domain matching
128
- if (target.includes(authorization.targetDomain) || authorization.targetDomain === '*') {
129
- return authorization;
130
- }
131
- }
132
- return undefined;
133
- }
134
- /**
135
- * Check if activity is out of scope
136
- */
137
- isActivityOutOfScope(activity, outOfScope) {
138
- const activityLower = activity.toLowerCase();
139
- return outOfScope.some(scope => activityLower.includes(scope.toLowerCase()) || scope.toLowerCase().includes(activityLower));
140
- }
141
- /**
142
- * Check scope limitations
143
- */
144
- checkScopeLimitations(activity, scopeLimitations) {
145
- for (const limitation of scopeLimitations) {
146
- const limitationLower = limitation.toLowerCase();
147
- const activityLower = activity.toLowerCase();
148
- // Check for common limitation patterns
149
- if (limitationLower.includes('read-only') && activityLower.includes('write')) {
150
- return 'Write operations prohibited in read-only scope';
151
- }
152
- if (limitationLower.includes('non-destructive') && this.isDestructiveActivity(activityLower)) {
153
- return 'Destructive activities prohibited in non-destructive scope';
154
- }
155
- if (limitationLower.includes('production') && activityLower.includes('staging')) {
156
- return 'Staging environment activities prohibited in production-only scope';
157
- }
158
- }
159
- return null;
160
- }
161
- /**
162
- * Check if activity is potentially destructive
163
- */
164
- isDestructiveActivity(activity) {
165
- const destructiveKeywords = [
166
- 'delete', 'drop', 'remove', 'truncate', 'wipe', 'erase',
167
- 'destroy', 'overwrite', 'format', 'shutdown', 'reboot'
168
- ];
169
- return destructiveKeywords.some(keyword => activity.includes(keyword));
170
- }
171
- }
172
- //# sourceMappingURL=securityAuthorization.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"securityAuthorization.js","sourceRoot":"","sources":["../../../src/security/authorization/securityAuthorization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoCH;;GAEG;AACH,MAAM,OAAO,2BAA2B;IAC9B,cAAc,CAAmC;IAEzD;QACE,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CAAC,OAA6B;QACrD,MAAM,aAAa,GAAwB;YACzC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE;YAChD,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;YACpC,iBAAiB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAC3C,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,MAAM,EAAE,YAAY;YACpB,eAAe,EAAE,IAAI,CAAC,uBAAuB,EAAE;SAChD,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QAEtE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