agentic-qe 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/.claude/agents/qe-coverage-analyzer.md +8 -0
  2. package/.claude/agents/qe-flaky-test-hunter.md +9 -1
  3. package/.claude/agents/qe-test-generator.md +7 -0
  4. package/.claude/agents/reasoning/agent.md +816 -0
  5. package/.claude/agents/reasoning/goal-planner.md +73 -0
  6. package/.claude/settings.json +21 -20
  7. package/.claude/skills/README.md +124 -0
  8. package/.claude/skills/agentdb-advanced/SKILL.md +550 -0
  9. package/.claude/skills/agentdb-learning/SKILL.md +545 -0
  10. package/.claude/skills/agentdb-memory-patterns/SKILL.md +339 -0
  11. package/.claude/skills/agentdb-optimization/SKILL.md +509 -0
  12. package/.claude/skills/agentdb-vector-search/SKILL.md +339 -0
  13. package/.claude/skills/agentic-quality-engineering/SKILL.md +604 -0
  14. package/.claude/skills/api-testing-patterns/SKILL.md +686 -0
  15. package/.claude/skills/bug-reporting-excellence/SKILL.md +632 -0
  16. package/.claude/skills/code-review-quality/SKILL.md +683 -0
  17. package/.claude/skills/consultancy-practices/SKILL.md +540 -0
  18. package/.claude/skills/context-driven-testing/SKILL.md +466 -0
  19. package/.claude/skills/exploratory-testing-advanced/SKILL.md +676 -0
  20. package/.claude/skills/flow-nexus-neural/SKILL.md +738 -0
  21. package/.claude/skills/flow-nexus-platform/SKILL.md +1157 -0
  22. package/.claude/skills/flow-nexus-swarm/SKILL.md +610 -0
  23. package/.claude/skills/github-code-review/SKILL.md +1140 -0
  24. package/.claude/skills/github-multi-repo/SKILL.md +874 -0
  25. package/.claude/skills/github-project-management/SKILL.md +1277 -0
  26. package/.claude/skills/github-release-management/SKILL.md +1081 -0
  27. package/.claude/skills/github-workflow-automation/SKILL.md +1065 -0
  28. package/.claude/skills/hive-mind-advanced/SKILL.md +712 -0
  29. package/.claude/skills/holistic-testing-pact/SKILL.md +225 -0
  30. package/.claude/skills/hooks-automation/SKILL.md +1201 -0
  31. package/.claude/skills/pair-programming/SKILL.md +1202 -0
  32. package/.claude/skills/performance-analysis/SKILL.md +563 -0
  33. package/.claude/skills/performance-testing/SKILL.md +662 -0
  34. package/.claude/skills/quality-metrics/SKILL.md +592 -0
  35. package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
  36. package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
  37. package/.claude/skills/refactoring-patterns/SKILL.md +778 -0
  38. package/.claude/skills/risk-based-testing/SKILL.md +721 -0
  39. package/.claude/skills/security-testing/SKILL.md +651 -0
  40. package/.claude/skills/skill-builder/SKILL.md +910 -0
  41. package/.claude/skills/sparc-methodology/SKILL.md +1115 -0
  42. package/.claude/skills/stream-chain/SKILL.md +563 -0
  43. package/.claude/skills/swarm-advanced/SKILL.md +973 -0
  44. package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
  45. package/.claude/skills/tdd-london-chicago/SKILL.md +567 -0
  46. package/.claude/skills/technical-writing/SKILL.md +235 -0
  47. package/.claude/skills/test-automation-strategy/SKILL.md +842 -0
  48. package/.claude/skills/verification-quality/SKILL.md +649 -0
  49. package/.claude/skills/xp-practices/SKILL.md +671 -0
  50. package/.claude/statusline-command.sh +176 -0
  51. package/CHANGELOG.md +536 -1
  52. package/README.md +92 -3
  53. package/config/improvement-loop.config.ts +323 -0
  54. package/config/neural-agent.config.ts +197 -0
  55. package/dist/adapters/MemoryStoreAdapter.d.ts +16 -16
  56. package/dist/adapters/MemoryStoreAdapter.d.ts.map +1 -1
  57. package/dist/adapters/MemoryStoreAdapter.js +16 -16
  58. package/dist/adapters/MemoryStoreAdapter.js.map +1 -1
  59. package/dist/agents/BaseAgent.d.ts +69 -0
  60. package/dist/agents/BaseAgent.d.ts.map +1 -1
  61. package/dist/agents/BaseAgent.js +382 -1
  62. package/dist/agents/BaseAgent.js.map +1 -1
  63. package/dist/agents/CoverageAnalyzerAgent.d.ts +13 -2
  64. package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -1
  65. package/dist/agents/CoverageAnalyzerAgent.js +105 -6
  66. package/dist/agents/CoverageAnalyzerAgent.js.map +1 -1
  67. package/dist/agents/DeploymentReadinessAgent.d.ts.map +1 -1
  68. package/dist/agents/DeploymentReadinessAgent.js +13 -13
  69. package/dist/agents/DeploymentReadinessAgent.js.map +1 -1
  70. package/dist/agents/FlakyTestHunterAgent.d.ts +28 -0
  71. package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
  72. package/dist/agents/FlakyTestHunterAgent.js +159 -4
  73. package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
  74. package/dist/agents/FleetCommanderAgent.d.ts.map +1 -1
  75. package/dist/agents/FleetCommanderAgent.js +2 -2
  76. package/dist/agents/FleetCommanderAgent.js.map +1 -1
  77. package/dist/agents/LearningAgent.d.ts +14 -5
  78. package/dist/agents/LearningAgent.d.ts.map +1 -1
  79. package/dist/agents/LearningAgent.js +36 -16
  80. package/dist/agents/LearningAgent.js.map +1 -1
  81. package/dist/agents/NeuralAgentExtension.d.ts +117 -0
  82. package/dist/agents/NeuralAgentExtension.d.ts.map +1 -0
  83. package/dist/agents/NeuralAgentExtension.js +288 -0
  84. package/dist/agents/NeuralAgentExtension.js.map +1 -0
  85. package/dist/agents/PerformanceTesterAgent.d.ts.map +1 -1
  86. package/dist/agents/PerformanceTesterAgent.js +4 -3
  87. package/dist/agents/PerformanceTesterAgent.js.map +1 -1
  88. package/dist/agents/ProductionIntelligenceAgent.js +7 -7
  89. package/dist/agents/ProductionIntelligenceAgent.js.map +1 -1
  90. package/dist/agents/QualityAnalyzerAgent.d.ts.map +1 -1
  91. package/dist/agents/QualityAnalyzerAgent.js +2 -2
  92. package/dist/agents/QualityAnalyzerAgent.js.map +1 -1
  93. package/dist/agents/QualityGateAgent.js +5 -5
  94. package/dist/agents/QualityGateAgent.js.map +1 -1
  95. package/dist/agents/RegressionRiskAnalyzerAgent.js +7 -7
  96. package/dist/agents/RegressionRiskAnalyzerAgent.js.map +1 -1
  97. package/dist/agents/RequirementsValidatorAgent.d.ts.map +1 -1
  98. package/dist/agents/RequirementsValidatorAgent.js +1 -1
  99. package/dist/agents/RequirementsValidatorAgent.js.map +1 -1
  100. package/dist/agents/SecurityScannerAgent.js +6 -6
  101. package/dist/agents/SecurityScannerAgent.js.map +1 -1
  102. package/dist/agents/TestExecutorAgent.d.ts.map +1 -1
  103. package/dist/agents/TestExecutorAgent.js +1 -3
  104. package/dist/agents/TestExecutorAgent.js.map +1 -1
  105. package/dist/agents/TestGeneratorAgent.d.ts +15 -4
  106. package/dist/agents/TestGeneratorAgent.d.ts.map +1 -1
  107. package/dist/agents/TestGeneratorAgent.js +165 -43
  108. package/dist/agents/TestGeneratorAgent.js.map +1 -1
  109. package/dist/agents/mixins/NeuralCapableMixin.d.ts +130 -0
  110. package/dist/agents/mixins/NeuralCapableMixin.d.ts.map +1 -0
  111. package/dist/agents/mixins/NeuralCapableMixin.js +358 -0
  112. package/dist/agents/mixins/NeuralCapableMixin.js.map +1 -0
  113. package/dist/agents/mixins/QUICCapableMixin.d.ts +34 -0
  114. package/dist/agents/mixins/QUICCapableMixin.d.ts.map +1 -0
  115. package/dist/agents/mixins/QUICCapableMixin.js +346 -0
  116. package/dist/agents/mixins/QUICCapableMixin.js.map +1 -0
  117. package/dist/cli/commands/agent/index.d.ts +5 -0
  118. package/dist/cli/commands/agent/index.d.ts.map +1 -1
  119. package/dist/cli/commands/agent/index.js +11 -6
  120. package/dist/cli/commands/agent/index.js.map +1 -1
  121. package/dist/cli/commands/agent/kill.d.ts +13 -0
  122. package/dist/cli/commands/agent/kill.d.ts.map +1 -0
  123. package/dist/cli/commands/agent/kill.js +65 -0
  124. package/dist/cli/commands/agent/kill.js.map +1 -0
  125. package/dist/cli/commands/agent/list.d.ts +19 -0
  126. package/dist/cli/commands/agent/list.d.ts.map +1 -0
  127. package/dist/cli/commands/agent/list.js +92 -0
  128. package/dist/cli/commands/agent/list.js.map +1 -0
  129. package/dist/cli/commands/agent/logs.d.ts +14 -0
  130. package/dist/cli/commands/agent/logs.d.ts.map +1 -0
  131. package/dist/cli/commands/agent/logs.js +77 -0
  132. package/dist/cli/commands/agent/logs.js.map +1 -0
  133. package/dist/cli/commands/agent/metrics.d.ts +21 -0
  134. package/dist/cli/commands/agent/metrics.d.ts.map +1 -0
  135. package/dist/cli/commands/agent/metrics.js +87 -0
  136. package/dist/cli/commands/agent/metrics.js.map +1 -0
  137. package/dist/cli/commands/agent/spawn.d.ts +28 -0
  138. package/dist/cli/commands/agent/spawn.d.ts.map +1 -0
  139. package/dist/cli/commands/agent/spawn.js +83 -0
  140. package/dist/cli/commands/agent/spawn.js.map +1 -0
  141. package/dist/cli/commands/init.d.ts +24 -0
  142. package/dist/cli/commands/init.d.ts.map +1 -1
  143. package/dist/cli/commands/init.js +475 -7
  144. package/dist/cli/commands/init.js.map +1 -1
  145. package/dist/cli/commands/skills/index.d.ts +51 -0
  146. package/dist/cli/commands/skills/index.d.ts.map +1 -0
  147. package/dist/cli/commands/skills/index.js +364 -0
  148. package/dist/cli/commands/skills/index.js.map +1 -0
  149. package/dist/cli/index.js +92 -1
  150. package/dist/cli/index.js.map +1 -1
  151. package/dist/core/EventBus.d.ts +38 -0
  152. package/dist/core/EventBus.d.ts.map +1 -1
  153. package/dist/core/EventBus.js +176 -31
  154. package/dist/core/EventBus.js.map +1 -1
  155. package/dist/core/FleetManager.d.ts +35 -1
  156. package/dist/core/FleetManager.d.ts.map +1 -1
  157. package/dist/core/FleetManager.js +121 -45
  158. package/dist/core/FleetManager.js.map +1 -1
  159. package/dist/core/MemoryManager.d.ts +19 -1
  160. package/dist/core/MemoryManager.d.ts.map +1 -1
  161. package/dist/core/MemoryManager.js +25 -1
  162. package/dist/core/MemoryManager.js.map +1 -1
  163. package/dist/core/embeddings/EmbeddingCache.d.ts +134 -0
  164. package/dist/core/embeddings/EmbeddingCache.d.ts.map +1 -0
  165. package/dist/core/embeddings/EmbeddingCache.js +239 -0
  166. package/dist/core/embeddings/EmbeddingCache.js.map +1 -0
  167. package/dist/core/embeddings/EmbeddingGenerator.d.ts +224 -0
  168. package/dist/core/embeddings/EmbeddingGenerator.d.ts.map +1 -0
  169. package/dist/core/embeddings/EmbeddingGenerator.js +459 -0
  170. package/dist/core/embeddings/EmbeddingGenerator.js.map +1 -0
  171. package/dist/core/embeddings/index.d.ts +15 -0
  172. package/dist/core/embeddings/index.d.ts.map +1 -0
  173. package/dist/core/embeddings/index.js +22 -0
  174. package/dist/core/embeddings/index.js.map +1 -0
  175. package/dist/core/memory/AgentDBIntegration.d.ts +35 -0
  176. package/dist/core/memory/AgentDBIntegration.d.ts.map +1 -0
  177. package/dist/core/memory/AgentDBIntegration.js +75 -0
  178. package/dist/core/memory/AgentDBIntegration.js.map +1 -0
  179. package/dist/core/memory/AgentDBManager.d.ts +200 -0
  180. package/dist/core/memory/AgentDBManager.d.ts.map +1 -0
  181. package/dist/core/memory/AgentDBManager.js +263 -0
  182. package/dist/core/memory/AgentDBManager.js.map +1 -0
  183. package/dist/core/memory/AgentDBService.d.ts +160 -0
  184. package/dist/core/memory/AgentDBService.d.ts.map +1 -0
  185. package/dist/core/memory/AgentDBService.js +450 -0
  186. package/dist/core/memory/AgentDBService.js.map +1 -0
  187. package/dist/core/memory/RealAgentDBAdapter.d.ts +51 -0
  188. package/dist/core/memory/RealAgentDBAdapter.d.ts.map +1 -0
  189. package/dist/core/memory/RealAgentDBAdapter.js +230 -0
  190. package/dist/core/memory/RealAgentDBAdapter.js.map +1 -0
  191. package/dist/core/memory/ReasoningBankAdapter.d.ts +58 -0
  192. package/dist/core/memory/ReasoningBankAdapter.d.ts.map +1 -0
  193. package/dist/core/memory/ReasoningBankAdapter.js +80 -0
  194. package/dist/core/memory/ReasoningBankAdapter.js.map +1 -0
  195. package/dist/core/memory/SwarmMemoryManager.d.ts +75 -3
  196. package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
  197. package/dist/core/memory/SwarmMemoryManager.js +236 -52
  198. package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
  199. package/dist/core/memory/index.d.ts +4 -0
  200. package/dist/core/memory/index.d.ts.map +1 -1
  201. package/dist/core/memory/index.js +9 -1
  202. package/dist/core/memory/index.js.map +1 -1
  203. package/dist/core/neural/NeuralTrainer.d.ts +137 -0
  204. package/dist/core/neural/NeuralTrainer.d.ts.map +1 -0
  205. package/dist/core/neural/NeuralTrainer.js +543 -0
  206. package/dist/core/neural/NeuralTrainer.js.map +1 -0
  207. package/dist/core/neural/index.d.ts +8 -0
  208. package/dist/core/neural/index.d.ts.map +1 -0
  209. package/dist/core/neural/index.js +24 -0
  210. package/dist/core/neural/index.js.map +1 -0
  211. package/dist/core/neural/types.d.ts +216 -0
  212. package/dist/core/neural/types.d.ts.map +1 -0
  213. package/dist/core/neural/types.js +8 -0
  214. package/dist/core/neural/types.js.map +1 -0
  215. package/dist/core/security/CertificateValidator.d.ts +130 -0
  216. package/dist/core/security/CertificateValidator.d.ts.map +1 -0
  217. package/dist/core/security/CertificateValidator.js +376 -0
  218. package/dist/core/security/CertificateValidator.js.map +1 -0
  219. package/dist/core/transport/QUICTransport.d.ts +62 -0
  220. package/dist/core/transport/QUICTransport.d.ts.map +1 -0
  221. package/dist/core/transport/QUICTransport.js +381 -0
  222. package/dist/core/transport/QUICTransport.js.map +1 -0
  223. package/dist/core/transport/SecureQUICTransport.d.ts +71 -0
  224. package/dist/core/transport/SecureQUICTransport.d.ts.map +1 -0
  225. package/dist/core/transport/SecureQUICTransport.js +253 -0
  226. package/dist/core/transport/SecureQUICTransport.js.map +1 -0
  227. package/dist/learning/AdvancedFeatureExtractor.d.ts +123 -0
  228. package/dist/learning/AdvancedFeatureExtractor.d.ts.map +1 -0
  229. package/dist/learning/AdvancedFeatureExtractor.js +423 -0
  230. package/dist/learning/AdvancedFeatureExtractor.js.map +1 -0
  231. package/dist/learning/FlakyPredictionModel.d.ts +11 -1
  232. package/dist/learning/FlakyPredictionModel.d.ts.map +1 -1
  233. package/dist/learning/FlakyPredictionModel.js +82 -35
  234. package/dist/learning/FlakyPredictionModel.js.map +1 -1
  235. package/dist/learning/FlakyTestDetector.d.ts +9 -0
  236. package/dist/learning/FlakyTestDetector.d.ts.map +1 -1
  237. package/dist/learning/FlakyTestDetector.js +28 -6
  238. package/dist/learning/FlakyTestDetector.js.map +1 -1
  239. package/dist/learning/ImprovementLoop.d.ts +16 -2
  240. package/dist/learning/ImprovementLoop.d.ts.map +1 -1
  241. package/dist/learning/ImprovementLoop.js +67 -8
  242. package/dist/learning/ImprovementLoop.js.map +1 -1
  243. package/dist/learning/ImprovementWorker.d.ts +83 -0
  244. package/dist/learning/ImprovementWorker.d.ts.map +1 -0
  245. package/dist/learning/ImprovementWorker.js +164 -0
  246. package/dist/learning/ImprovementWorker.js.map +1 -0
  247. package/dist/learning/NeuralPatternMatcher.d.ts +184 -0
  248. package/dist/learning/NeuralPatternMatcher.d.ts.map +1 -0
  249. package/dist/learning/NeuralPatternMatcher.js +702 -0
  250. package/dist/learning/NeuralPatternMatcher.js.map +1 -0
  251. package/dist/learning/NeuralTrainer.d.ts +209 -0
  252. package/dist/learning/NeuralTrainer.d.ts.map +1 -0
  253. package/dist/learning/NeuralTrainer.js +478 -0
  254. package/dist/learning/NeuralTrainer.js.map +1 -0
  255. package/dist/learning/index.d.ts +13 -7
  256. package/dist/learning/index.d.ts.map +1 -1
  257. package/dist/learning/index.js +27 -11
  258. package/dist/learning/index.js.map +1 -1
  259. package/dist/learning/types.d.ts +1 -0
  260. package/dist/learning/types.d.ts.map +1 -1
  261. package/dist/learning/types.js +16 -0
  262. package/dist/learning/types.js.map +1 -1
  263. package/dist/mcp/MCPToolRegistry.d.ts +34 -0
  264. package/dist/mcp/MCPToolRegistry.d.ts.map +1 -0
  265. package/dist/mcp/MCPToolRegistry.js +48 -0
  266. package/dist/mcp/MCPToolRegistry.js.map +1 -0
  267. package/dist/mcp/server.d.ts +4 -4
  268. package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
  269. package/dist/mcp/services/AgentRegistry.js +7 -1
  270. package/dist/mcp/services/AgentRegistry.js.map +1 -1
  271. package/dist/transport/QUICTransport.d.ts +340 -0
  272. package/dist/transport/QUICTransport.d.ts.map +1 -0
  273. package/dist/transport/QUICTransport.js +814 -0
  274. package/dist/transport/QUICTransport.js.map +1 -0
  275. package/dist/transport/UDPTransport.d.ts +348 -0
  276. package/dist/transport/UDPTransport.d.ts.map +1 -0
  277. package/dist/transport/UDPTransport.js +820 -0
  278. package/dist/transport/UDPTransport.js.map +1 -0
  279. package/dist/types/errors.d.ts +1 -1
  280. package/dist/types/index.d.ts +37 -0
  281. package/dist/types/index.d.ts.map +1 -1
  282. package/dist/types/index.js +2 -0
  283. package/dist/types/index.js.map +1 -1
  284. package/dist/types/quic.d.ts +339 -0
  285. package/dist/types/quic.d.ts.map +1 -0
  286. package/dist/types/quic.js +48 -0
  287. package/dist/types/quic.js.map +1 -0
  288. package/dist/utils/Config.js +1 -1
  289. package/dist/utils/Config.js.map +1 -1
  290. package/dist/utils/Database.d.ts +14 -0
  291. package/dist/utils/Database.d.ts.map +1 -1
  292. package/dist/utils/Database.js +51 -4
  293. package/dist/utils/Database.js.map +1 -1
  294. package/dist/utils/Logger.d.ts.map +1 -1
  295. package/dist/utils/Logger.js +111 -26
  296. package/dist/utils/Logger.js.map +1 -1
  297. package/package.json +30 -7
@@ -0,0 +1,651 @@
1
+ ---
2
+ name: security-testing
3
+ description: Test for security vulnerabilities using OWASP principles and security testing techniques. Use when conducting security audits, testing authentication/authorization, or implementing security practices.
4
+ version: 1.0.0
5
+ category: testing
6
+ tags: [security, owasp, penetration-testing, vulnerability-scanning, authentication, authorization]
7
+ difficulty: advanced
8
+ estimated_time: 60 minutes
9
+ author: user
10
+ ---
11
+
12
+ # Security Testing
13
+
14
+ ## Core Philosophy
15
+
16
+ Security is not a feature you add at the end. It's a quality attribute you build in from the start. Test for security issues like you test for functional issues - continuously and realistically.
17
+
18
+ **Key principle:** Think like an attacker, build like a defender.
19
+
20
+ ## OWASP Top 10 (2021) - Must Test
21
+
22
+ ### 1. Broken Access Control
23
+ **Risk:** Users accessing resources they shouldn't
24
+
25
+ **Test Scenarios:**
26
+ ```javascript
27
+ // Horizontal privilege escalation
28
+ test('user cannot access another user\'s order', async () => {
29
+ const userAToken = await login('userA');
30
+ const userBOrder = await createOrder('userB');
31
+
32
+ const response = await api.get(`/orders/${userBOrder.id}`, {
33
+ headers: { Authorization: `Bearer ${userAToken}` }
34
+ });
35
+
36
+ expect(response.status).toBe(403); // Forbidden
37
+ });
38
+
39
+ // Vertical privilege escalation
40
+ test('regular user cannot access admin endpoint', async () => {
41
+ const userToken = await login('regularUser');
42
+
43
+ const response = await api.get('/admin/users', {
44
+ headers: { Authorization: `Bearer ${userToken}` }
45
+ });
46
+
47
+ expect(response.status).toBe(403);
48
+ });
49
+
50
+ // Missing authorization check
51
+ test('unauthenticated user cannot create order', async () => {
52
+ const response = await api.post('/orders', orderData);
53
+ expect(response.status).toBe(401); // Unauthorized
54
+ });
55
+ ```
56
+
57
+ ### 2. Cryptographic Failures
58
+ **Risk:** Sensitive data exposed due to weak encryption
59
+
60
+ **Test Scenarios:**
61
+ ```javascript
62
+ test('passwords are hashed, not stored in plaintext', async () => {
63
+ const user = await db.users.create({
64
+ email: 'test@example.com',
65
+ password: 'MyPassword123'
66
+ });
67
+
68
+ const storedUser = await db.users.findById(user.id);
69
+ expect(storedUser.password).not.toBe('MyPassword123');
70
+ expect(storedUser.password).toMatch(/^\$2[aby]\$\d{2}\$/); // bcrypt format
71
+ });
72
+
73
+ test('sensitive data encrypted in transit', async () => {
74
+ const response = await fetch('https://api.example.com/profile');
75
+ expect(response.url).toStartWith('https://'); // Not http://
76
+ });
77
+
78
+ test('API does not return sensitive data unnecessarily', async () => {
79
+ const response = await api.get('/users/me');
80
+ expect(response.body).not.toHaveProperty('password');
81
+ expect(response.body).not.toHaveProperty('ssn');
82
+ expect(response.body).not.toHaveProperty('creditCard');
83
+ });
84
+ ```
85
+
86
+ ### 3. Injection
87
+ **Risk:** SQL injection, command injection, XSS
88
+
89
+ **Test Scenarios:**
90
+ ```javascript
91
+ // SQL Injection
92
+ test('prevents SQL injection in search', async () => {
93
+ const maliciousQuery = "' OR '1'='1";
94
+ const response = await api.get(`/products?search=${maliciousQuery}`);
95
+
96
+ // Should return empty or sanitized results, not all products
97
+ expect(response.body.length).toBeLessThan(100);
98
+ });
99
+
100
+ // Command Injection
101
+ test('prevents command injection in file upload', async () => {
102
+ const maliciousFilename = '; rm -rf /';
103
+ const response = await api.post('/upload', {
104
+ filename: maliciousFilename,
105
+ content: 'test'
106
+ });
107
+
108
+ expect(response.status).toBe(400); // Rejected
109
+ });
110
+
111
+ // XSS (Cross-Site Scripting)
112
+ test('sanitizes user input in HTML output', async () => {
113
+ const maliciousInput = '<script>alert("XSS")</script>';
114
+ await api.post('/comments', { text: maliciousInput });
115
+
116
+ const response = await api.get('/comments');
117
+ const html = response.body;
118
+
119
+ // Should be escaped, not executable
120
+ expect(html).toContain('&lt;script&gt;');
121
+ expect(html).not.toContain('<script>');
122
+ });
123
+ ```
124
+
125
+ ### 4. Insecure Design
126
+ **Risk:** Fundamental security flaws in architecture
127
+
128
+ **Review Checklist:**
129
+ - [ ] Principle of least privilege (minimal permissions)
130
+ - [ ] Defense in depth (multiple security layers)
131
+ - [ ] Fail securely (errors don't expose info)
132
+ - [ ] Secure defaults (secure by default, not opt-in)
133
+
134
+ **Test Scenarios:**
135
+ ```javascript
136
+ test('rate limiting prevents brute force', async () => {
137
+ const attempts = 20;
138
+ const responses = [];
139
+
140
+ for (let i = 0; i < attempts; i++) {
141
+ responses.push(await api.post('/login', {
142
+ email: 'test@example.com',
143
+ password: 'wrong'
144
+ }));
145
+ }
146
+
147
+ const rateLimited = responses.filter(r => r.status === 429);
148
+ expect(rateLimited.length).toBeGreaterThan(0);
149
+ });
150
+
151
+ test('session expires after timeout', async () => {
152
+ const token = await login();
153
+
154
+ // Wait for session timeout (e.g., 30 minutes)
155
+ await sleep(31 * 60 * 1000);
156
+
157
+ const response = await api.get('/profile', {
158
+ headers: { Authorization: `Bearer ${token}` }
159
+ });
160
+
161
+ expect(response.status).toBe(401); // Expired
162
+ });
163
+ ```
164
+
165
+ ### 5. Security Misconfiguration
166
+ **Risk:** Default configs, exposed admin panels, verbose errors
167
+
168
+ **Test Scenarios:**
169
+ ```javascript
170
+ test('error messages do not leak sensitive info', async () => {
171
+ const response = await api.post('/login', {
172
+ email: 'nonexistent@example.com',
173
+ password: 'wrong'
174
+ });
175
+
176
+ // Should be generic, not "user doesn't exist" vs "wrong password"
177
+ expect(response.body.error).toBe('Invalid credentials');
178
+ });
179
+
180
+ test('admin panel not accessible without auth', async () => {
181
+ const response = await fetch('https://example.com/admin');
182
+ expect(response.status).toBe(401);
183
+ });
184
+
185
+ test('sensitive endpoints not exposed', async () => {
186
+ const endpoints = [
187
+ '/debug', '/.env', '/config', '/.git',
188
+ '/admin', '/phpinfo.php', '/server-status'
189
+ ];
190
+
191
+ for (let endpoint of endpoints) {
192
+ const response = await fetch(`https://example.com${endpoint}`);
193
+ expect(response.status).not.toBe(200);
194
+ }
195
+ });
196
+ ```
197
+
198
+ ### 6. Vulnerable and Outdated Components
199
+ **Risk:** Using libraries with known vulnerabilities
200
+
201
+ **Prevention:**
202
+ ```bash
203
+ # Check for vulnerabilities regularly
204
+ npm audit
205
+ npm audit fix
206
+
207
+ # Or with Yarn
208
+ yarn audit
209
+
210
+ # Use Snyk, Dependabot, or similar
211
+ snyk test
212
+ ```
213
+
214
+ **CI/CD Integration:**
215
+ ```yaml
216
+ # GitHub Actions example
217
+ - name: Security audit
218
+ run: npm audit --audit-level=high
219
+
220
+ - name: Check for outdated packages
221
+ run: npm outdated
222
+ ```
223
+
224
+ ### 7. Identification and Authentication Failures
225
+ **Risk:** Weak passwords, poor session management
226
+
227
+ **Test Scenarios:**
228
+ ```javascript
229
+ test('rejects weak passwords', async () => {
230
+ const weakPasswords = ['123456', 'password', 'abc123'];
231
+
232
+ for (let pwd of weakPasswords) {
233
+ const response = await api.post('/register', {
234
+ email: 'test@example.com',
235
+ password: pwd
236
+ });
237
+ expect(response.status).toBe(400);
238
+ }
239
+ });
240
+
241
+ test('enforces multi-factor authentication for sensitive ops', async () => {
242
+ const token = await login('user@example.com', 'password');
243
+
244
+ // Try to change email without MFA
245
+ const response = await api.put('/profile/email', {
246
+ newEmail: 'new@example.com'
247
+ }, {
248
+ headers: { Authorization: `Bearer ${token}` }
249
+ });
250
+
251
+ expect(response.status).toBe(403); // Requires MFA
252
+ });
253
+
254
+ test('prevents session fixation', async () => {
255
+ const sessionBefore = await getSessionId();
256
+
257
+ await login('user@example.com', 'password');
258
+
259
+ const sessionAfter = await getSessionId();
260
+
261
+ // Session ID should change after login
262
+ expect(sessionAfter).not.toBe(sessionBefore);
263
+ });
264
+ ```
265
+
266
+ ### 8. Software and Data Integrity Failures
267
+ **Risk:** Unsigned updates, untrusted CI/CD pipeline
268
+
269
+ **Test Scenarios:**
270
+ ```javascript
271
+ test('API responses include integrity check', async () => {
272
+ const response = await api.get('/config');
273
+
274
+ // Should include checksum or signature
275
+ expect(response.headers['x-content-signature']).toBeDefined();
276
+ });
277
+
278
+ test('uploaded files are scanned for malware', async () => {
279
+ const maliciousFile = createTestVirusFile(); // EICAR test file
280
+
281
+ const response = await api.post('/upload', maliciousFile);
282
+
283
+ expect(response.status).toBe(400);
284
+ expect(response.body.error).toMatch(/malware|virus/i);
285
+ });
286
+ ```
287
+
288
+ ### 9. Security Logging and Monitoring Failures
289
+ **Risk:** Breaches not detected, no audit trail
290
+
291
+ **Test Scenarios:**
292
+ ```javascript
293
+ test('failed login attempts are logged', async () => {
294
+ await api.post('/login', { email: 'test@example.com', password: 'wrong' });
295
+
296
+ const logs = await getLogs('authentication');
297
+ const failedLogin = logs.find(l => l.event === 'login_failed');
298
+
299
+ expect(failedLogin).toBeDefined();
300
+ expect(failedLogin.ip).toBeDefined();
301
+ expect(failedLogin.timestamp).toBeDefined();
302
+ });
303
+
304
+ test('sensitive operations are audited', async () => {
305
+ const adminToken = await login('admin@example.com', 'password');
306
+
307
+ await api.delete('/users/123', {
308
+ headers: { Authorization: `Bearer ${adminToken}` }
309
+ });
310
+
311
+ const auditLog = await getAuditLog();
312
+ const deletion = auditLog.find(l => l.action === 'user_deleted');
313
+
314
+ expect(deletion.actor).toBe('admin@example.com');
315
+ expect(deletion.target).toBe('123');
316
+ });
317
+ ```
318
+
319
+ ### 10. Server-Side Request Forgery (SSRF)
320
+ **Risk:** Attacker makes server request internal resources
321
+
322
+ **Test Scenarios:**
323
+ ```javascript
324
+ test('prevents SSRF via URL parameter', async () => {
325
+ const internalUrl = 'http://localhost:8080/admin';
326
+
327
+ const response = await api.post('/fetch-url', {
328
+ url: internalUrl
329
+ });
330
+
331
+ expect(response.status).toBe(400); // Rejected
332
+ });
333
+
334
+ test('validates and sanitizes URL inputs', async () => {
335
+ const maliciousUrls = [
336
+ 'file:///etc/passwd',
337
+ 'http://169.254.169.254/latest/meta-data/', // AWS metadata
338
+ 'http://metadata.google.internal/', // GCP metadata
339
+ ];
340
+
341
+ for (let url of maliciousUrls) {
342
+ const response = await api.post('/fetch-url', { url });
343
+ expect(response.status).toBe(400);
344
+ }
345
+ });
346
+ ```
347
+
348
+ ## Security Testing Tools
349
+
350
+ ### Static Analysis (SAST)
351
+ - **SonarQube** - Code quality + security
352
+ - **Semgrep** - Fast, customizable rules
353
+ - **ESLint security plugins** - JavaScript
354
+ - **Bandit** - Python security linter
355
+
356
+ ### Dynamic Analysis (DAST)
357
+ - **OWASP ZAP** - Web app security scanner
358
+ - **Burp Suite** - Security testing platform
359
+ - **Nikto** - Web server scanner
360
+
361
+ ### Dependency Scanning
362
+ - **npm audit / yarn audit** - Node.js
363
+ - **Snyk** - Multi-language
364
+ - **Dependabot** - GitHub integration
365
+ - **OWASP Dependency-Check** - Multi-language
366
+
367
+ ### Secret Scanning
368
+ - **git-secrets** - Prevent secrets in commits
369
+ - **TruffleHog** - Find secrets in git history
370
+ - **GitGuardian** - Real-time secret detection
371
+
372
+ ## Penetration Testing Basics
373
+
374
+ ### Manual Testing Approach
375
+
376
+ 1. **Reconnaissance**
377
+ - Identify attack surface
378
+ - Map endpoints and functionality
379
+ - Note technologies used
380
+
381
+ 2. **Enumeration**
382
+ - Discover hidden endpoints
383
+ - Test common paths (/admin, /.env, /api)
384
+ - Check for information disclosure
385
+
386
+ 3. **Exploitation**
387
+ - Test for OWASP Top 10
388
+ - Try auth bypasses
389
+ - Test input validation
390
+
391
+ 4. **Reporting**
392
+ - Document findings
393
+ - Rate severity
394
+ - Provide remediation steps
395
+
396
+ ### Automated Scanning
397
+
398
+ ```bash
399
+ # OWASP ZAP baseline scan
400
+ docker run -t owasp/zap2docker-stable zap-baseline.py \
401
+ -t https://example.com \
402
+ -r report.html
403
+
404
+ # Nikto web server scan
405
+ nikto -h https://example.com
406
+
407
+ # Nmap port scan
408
+ nmap -sV -sC example.com
409
+ ```
410
+
411
+ ## Security in CI/CD
412
+
413
+ ### Pre-commit Hooks
414
+ ```bash
415
+ # .git/hooks/pre-commit
416
+ #!/bin/sh
417
+
418
+ # Check for secrets
419
+ git-secrets --scan
420
+
421
+ # Run security linter
422
+ npm run lint:security
423
+
424
+ # Abort commit if issues found
425
+ if [ $? -ne 0 ]; then
426
+ echo "Security issues found. Commit aborted."
427
+ exit 1
428
+ fi
429
+ ```
430
+
431
+ ### CI Pipeline
432
+ ```yaml
433
+ # GitHub Actions example
434
+ security-checks:
435
+ runs-on: ubuntu-latest
436
+ steps:
437
+ - uses: actions/checkout@v2
438
+
439
+ - name: Dependency audit
440
+ run: npm audit --audit-level=high
441
+
442
+ - name: SAST scan
443
+ run: npm run sast
444
+
445
+ - name: Secret scan
446
+ uses: trufflesecurity/trufflehog@main
447
+
448
+ - name: DAST scan (staging)
449
+ if: github.ref == 'refs/heads/main'
450
+ run: |
451
+ docker run owasp/zap2docker-stable \
452
+ zap-baseline.py -t https://staging.example.com
453
+ ```
454
+
455
+ ## Common Security Mistakes
456
+
457
+ ### ❌ Security by Obscurity
458
+ **Problem:** Hiding admin panel at `/super-secret-admin`
459
+ **Better:** Proper authentication + authorization
460
+
461
+ ### ❌ Client-Side Validation Only
462
+ **Problem:** JavaScript validation can be bypassed
463
+ **Better:** Always validate on server side
464
+
465
+ ### ❌ Trusting User Input
466
+ **Problem:** Assuming input is safe
467
+ **Better:** Sanitize, validate, escape all input
468
+
469
+ ### ❌ Hardcoded Secrets
470
+ **Problem:** API keys in code
471
+ **Better:** Environment variables, secret management
472
+
473
+ ### ❌ Insufficient Logging
474
+ **Problem:** Can't detect or investigate breaches
475
+ **Better:** Log security events, monitor for anomalies
476
+
477
+ ## Security Testing Checklist
478
+
479
+ ### Authentication
480
+ - [ ] Strong password requirements
481
+ - [ ] Password hashing (bcrypt, scrypt, Argon2)
482
+ - [ ] MFA for sensitive operations
483
+ - [ ] Account lockout after failed attempts
484
+ - [ ] Secure password reset flow
485
+ - [ ] Session timeout
486
+ - [ ] Session ID changes after login
487
+
488
+ ### Authorization
489
+ - [ ] Check authorization on every request
490
+ - [ ] Principle of least privilege
491
+ - [ ] No horizontal privilege escalation
492
+ - [ ] No vertical privilege escalation
493
+ - [ ] Resource-level authorization
494
+
495
+ ### Data Protection
496
+ - [ ] HTTPS everywhere
497
+ - [ ] Sensitive data encrypted at rest
498
+ - [ ] Secrets not in code or logs
499
+ - [ ] PII handling compliance (GDPR, etc.)
500
+ - [ ] Secure file uploads
501
+ - [ ] Safe data deletion
502
+
503
+ ### Input Validation
504
+ - [ ] Validate all input server-side
505
+ - [ ] Whitelist, not blacklist
506
+ - [ ] Parameterized queries (no SQL injection)
507
+ - [ ] Output encoding (no XSS)
508
+ - [ ] File upload restrictions
509
+ - [ ] Rate limiting
510
+
511
+ ### API Security
512
+ - [ ] Authentication required
513
+ - [ ] Authorization per endpoint
514
+ - [ ] CORS configured properly
515
+ - [ ] Rate limiting
516
+ - [ ] Input validation
517
+ - [ ] Error handling (no info leakage)
518
+
519
+ ### Infrastructure
520
+ - [ ] Keep dependencies updated
521
+ - [ ] Remove unnecessary services
522
+ - [ ] Secure defaults
523
+ - [ ] Regular security scans
524
+ - [ ] Secrets management
525
+ - [ ] Security headers configured
526
+
527
+ ## Real-World Example: API Security Audit
528
+
529
+ **Scenario:** E-commerce API security review
530
+
531
+ **Findings:**
532
+
533
+ 1. **Critical: Authorization Bypass**
534
+ ```javascript
535
+ // Vulnerable code
536
+ app.get('/orders/:id', (req, res) => {
537
+ const order = db.orders.findById(req.params.id);
538
+ res.json(order); // No ownership check!
539
+ });
540
+
541
+ // Fixed
542
+ app.get('/orders/:id', auth, (req, res) => {
543
+ const order = db.orders.findById(req.params.id);
544
+ if (order.userId !== req.user.id) {
545
+ return res.status(403).json({ error: 'Forbidden' });
546
+ }
547
+ res.json(order);
548
+ });
549
+ ```
550
+
551
+ 2. **High: Weak Password Policy**
552
+ - No minimum length
553
+ - No complexity requirements
554
+ - **Fix:** Require 12+ chars, mixed case, numbers
555
+
556
+ 3. **Medium: Verbose Error Messages**
557
+ - Stack traces in production
558
+ - **Fix:** Generic errors for clients, detailed logs server-side
559
+
560
+ 4. **Low: Missing Security Headers**
561
+ - No HSTS, CSP, X-Frame-Options
562
+ - **Fix:** Add helmet.js middleware
563
+
564
+ **Result:** 4 vulnerabilities fixed before production launch.
565
+
566
+ ## Using with QE Agents
567
+
568
+ ### Multi-Layer Security Scanning
569
+
570
+ **qe-security-scanner** performs comprehensive security testing:
571
+ ```typescript
572
+ // Agent runs multi-layer security scan
573
+ const securityScan = await agent.comprehensiveScan({
574
+ target: 'src/',
575
+ layers: {
576
+ sast: true, // Static analysis
577
+ dast: true, // Dynamic analysis
578
+ dependencies: true, // npm audit
579
+ secrets: true, // Secret scanning
580
+ containers: true // Docker image scanning
581
+ },
582
+ severity: ['critical', 'high', 'medium']
583
+ });
584
+
585
+ // Returns categorized vulnerabilities
586
+ ```
587
+
588
+ ### OWASP Top 10 Automated Testing
589
+
590
+ ```typescript
591
+ // Agent tests all OWASP Top 10 vulnerabilities
592
+ const owaspTest = await agent.testOWASP({
593
+ categories: [
594
+ 'broken-access-control',
595
+ 'cryptographic-failures',
596
+ 'injection',
597
+ 'insecure-design',
598
+ 'security-misconfiguration'
599
+ ],
600
+ depth: 'comprehensive'
601
+ });
602
+ ```
603
+
604
+ ### Vulnerability Fix Validation
605
+
606
+ ```typescript
607
+ // Agent validates security fix
608
+ const validation = await agent.validateFix({
609
+ vulnerability: 'CVE-2024-12345',
610
+ expectedResolution: 'upgrade package to v2.0.0',
611
+ retestAfterFix: true
612
+ });
613
+
614
+ // Returns: { fixed: true, retestPassed: true, residualRisk: 'low' }
615
+ ```
616
+
617
+ ### Security Fleet Coordination
618
+
619
+ ```typescript
620
+ const securityFleet = await FleetManager.coordinate({
621
+ strategy: 'security-testing',
622
+ agents: [
623
+ 'qe-security-scanner', // Run scans
624
+ 'qe-api-contract-validator', // API security
625
+ 'qe-quality-analyzer', // Code security review
626
+ 'qe-deployment-readiness' // Security gate
627
+ ],
628
+ topology: 'parallel'
629
+ });
630
+ ```
631
+
632
+ ---
633
+
634
+ ## Related Skills
635
+
636
+ **Testing:**
637
+ - [agentic-quality-engineering](../agentic-quality-engineering/) - Security testing coordination
638
+ - [api-testing-patterns](../api-testing-patterns/) - API security testing
639
+
640
+ **Development:**
641
+ - [code-review-quality](../code-review-quality/) - Security code review
642
+
643
+ **Quality:**
644
+ - [quality-metrics](../quality-metrics/) - Security metrics tracking
645
+
646
+ ## Remember
647
+
648
+ Security testing is not a one-time activity. It's an ongoing process. Build security into your development workflow, test continuously, and stay informed about new threats.
649
+
650
+ **Think like an attacker:** What would you try to break? Test that.
651
+ **Build like a defender:** Assume input is malicious until proven otherwise.