@claude-flow/shared 3.0.0-alpha.7 → 3.0.0-alpha.8

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 (195) hide show
  1. package/.claude-flow/daemon-state.json +135 -0
  2. package/.claude-flow/data/pending-insights.jsonl +2 -0
  3. package/.claude-flow/data/ranked-context.json +5 -0
  4. package/.claude-flow/logs/daemon.log +45 -0
  5. package/.claude-flow/logs/headless/audit_1777379186972_h5un5x_prompt.log +3210 -0
  6. package/.claude-flow/logs/headless/audit_1777379186972_h5un5x_result.log +117 -0
  7. package/.claude-flow/logs/headless/audit_1777379816437_w0eaul_prompt.log +3210 -0
  8. package/.claude-flow/logs/headless/audit_1777379816437_w0eaul_result.log +53 -0
  9. package/.claude-flow/logs/headless/audit_1777380440097_621y8m_prompt.log +3210 -0
  10. package/.claude-flow/logs/headless/audit_1777380440097_621y8m_result.log +75 -0
  11. package/.claude-flow/logs/headless/optimize_1777379306973_an4lmy_prompt.log +3504 -0
  12. package/.claude-flow/logs/headless/optimize_1777379306973_an4lmy_result.log +166 -0
  13. package/.claude-flow/logs/headless/optimize_1777380274732_apxz3s_prompt.log +3504 -0
  14. package/.claude-flow/logs/headless/optimize_1777380274732_apxz3s_result.log +219 -0
  15. package/.claude-flow/logs/headless/testgaps_1777379546969_dvf2a1_prompt.log +3189 -0
  16. package/.claude-flow/logs/headless/testgaps_1777379546969_dvf2a1_result.log +155 -0
  17. package/.claude-flow/metrics/codebase-map.json +11 -0
  18. package/.claude-flow/metrics/consolidation.json +6 -0
  19. package/.claude-flow/sessions/current.json +13 -0
  20. package/.swarm/hnsw.index +0 -0
  21. package/.swarm/hnsw.metadata.json +1 -0
  22. package/.swarm/memory.db +0 -0
  23. package/.swarm/memory.db-shm +0 -0
  24. package/.swarm/memory.db-wal +0 -0
  25. package/.swarm/schema.sql +305 -0
  26. package/dist/core/config/schema.d.ts +96 -96
  27. package/dist/events/event-store.d.ts.map +1 -1
  28. package/dist/events/event-store.js +20 -9
  29. package/dist/events/event-store.js.map +1 -1
  30. package/dist/hooks/executor.d.ts.map +1 -1
  31. package/dist/hooks/executor.js +7 -4
  32. package/dist/hooks/executor.js.map +1 -1
  33. package/dist/hooks/verify-exports.test.js +6 -6
  34. package/dist/hooks/verify-exports.test.js.map +1 -1
  35. package/dist/mcp/server.d.ts.map +1 -1
  36. package/dist/mcp/server.js +3 -6
  37. package/dist/mcp/server.js.map +1 -1
  38. package/dist/mcp/types.d.ts +4 -6
  39. package/dist/mcp/types.d.ts.map +1 -1
  40. package/dist/mcp/types.js.map +1 -1
  41. package/package.json +3 -2
  42. package/ruvector.db +0 -0
  43. package/src/events/event-store.ts +18 -9
  44. package/src/hooks/executor.ts +7 -5
  45. package/src/hooks/verify-exports.test.ts +6 -6
  46. package/src/mcp/server.ts +3 -6
  47. package/src/mcp/types.ts +4 -6
  48. package/tsconfig.tsbuildinfo +1 -1
  49. package/.agentic-flow/intelligence.json +0 -16
  50. package/__tests__/coverage/base.css +0 -224
  51. package/__tests__/coverage/block-navigation.js +0 -87
  52. package/__tests__/coverage/coverage-final.json +0 -50
  53. package/__tests__/coverage/favicon.png +0 -0
  54. package/__tests__/coverage/index.html +0 -326
  55. package/__tests__/coverage/lcov-report/base.css +0 -224
  56. package/__tests__/coverage/lcov-report/block-navigation.js +0 -87
  57. package/__tests__/coverage/lcov-report/favicon.png +0 -0
  58. package/__tests__/coverage/lcov-report/index.html +0 -326
  59. package/__tests__/coverage/lcov-report/prettify.css +0 -1
  60. package/__tests__/coverage/lcov-report/prettify.js +0 -2
  61. package/__tests__/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  62. package/__tests__/coverage/lcov-report/sorter.js +0 -210
  63. package/__tests__/coverage/lcov-report/src/core/config/defaults.ts.html +0 -706
  64. package/__tests__/coverage/lcov-report/src/core/config/index.html +0 -161
  65. package/__tests__/coverage/lcov-report/src/core/config/loader.ts.html +0 -898
  66. package/__tests__/coverage/lcov-report/src/core/config/schema.ts.html +0 -649
  67. package/__tests__/coverage/lcov-report/src/core/config/validator.ts.html +0 -712
  68. package/__tests__/coverage/lcov-report/src/core/event-bus.ts.html +0 -793
  69. package/__tests__/coverage/lcov-report/src/core/index.html +0 -116
  70. package/__tests__/coverage/lcov-report/src/core/interfaces/event.interface.ts.html +0 -886
  71. package/__tests__/coverage/lcov-report/src/core/interfaces/index.html +0 -116
  72. package/__tests__/coverage/lcov-report/src/core/orchestrator/event-coordinator.ts.html +0 -451
  73. package/__tests__/coverage/lcov-report/src/core/orchestrator/health-monitor.ts.html +0 -727
  74. package/__tests__/coverage/lcov-report/src/core/orchestrator/index.html +0 -176
  75. package/__tests__/coverage/lcov-report/src/core/orchestrator/lifecycle-manager.ts.html +0 -874
  76. package/__tests__/coverage/lcov-report/src/core/orchestrator/session-manager.ts.html +0 -922
  77. package/__tests__/coverage/lcov-report/src/core/orchestrator/task-manager.ts.html +0 -1036
  78. package/__tests__/coverage/lcov-report/src/events/domain-events.ts.html +0 -1837
  79. package/__tests__/coverage/lcov-report/src/events/event-store.ts.html +0 -1849
  80. package/__tests__/coverage/lcov-report/src/events/example-usage.ts.html +0 -964
  81. package/__tests__/coverage/lcov-report/src/events/index.html +0 -176
  82. package/__tests__/coverage/lcov-report/src/events/projections.ts.html +0 -1768
  83. package/__tests__/coverage/lcov-report/src/events/state-reconstructor.ts.html +0 -1132
  84. package/__tests__/coverage/lcov-report/src/events.ts.html +0 -1186
  85. package/__tests__/coverage/lcov-report/src/hooks/example-usage.ts.html +0 -1582
  86. package/__tests__/coverage/lcov-report/src/hooks/executor.ts.html +0 -1222
  87. package/__tests__/coverage/lcov-report/src/hooks/index.html +0 -191
  88. package/__tests__/coverage/lcov-report/src/hooks/registry.ts.html +0 -1084
  89. package/__tests__/coverage/lcov-report/src/hooks/safety/bash-safety.ts.html +0 -1897
  90. package/__tests__/coverage/lcov-report/src/hooks/safety/file-organization.ts.html +0 -1504
  91. package/__tests__/coverage/lcov-report/src/hooks/safety/git-commit.ts.html +0 -1954
  92. package/__tests__/coverage/lcov-report/src/hooks/safety/index.html +0 -146
  93. package/__tests__/coverage/lcov-report/src/hooks/session-hooks.ts.html +0 -1762
  94. package/__tests__/coverage/lcov-report/src/hooks/task-hooks.ts.html +0 -1624
  95. package/__tests__/coverage/lcov-report/src/hooks/types.ts.html +0 -1156
  96. package/__tests__/coverage/lcov-report/src/index.html +0 -176
  97. package/__tests__/coverage/lcov-report/src/mcp/connection-pool.ts.html +0 -1399
  98. package/__tests__/coverage/lcov-report/src/mcp/index.html +0 -176
  99. package/__tests__/coverage/lcov-report/src/mcp/server.ts.html +0 -2407
  100. package/__tests__/coverage/lcov-report/src/mcp/session-manager.ts.html +0 -1369
  101. package/__tests__/coverage/lcov-report/src/mcp/tool-registry.ts.html +0 -1783
  102. package/__tests__/coverage/lcov-report/src/mcp/transport/http.ts.html +0 -1756
  103. package/__tests__/coverage/lcov-report/src/mcp/transport/index.html +0 -146
  104. package/__tests__/coverage/lcov-report/src/mcp/transport/stdio.ts.html +0 -1057
  105. package/__tests__/coverage/lcov-report/src/mcp/transport/websocket.ts.html +0 -1537
  106. package/__tests__/coverage/lcov-report/src/mcp/types.ts.html +0 -1780
  107. package/__tests__/coverage/lcov-report/src/plugin-interface.ts.html +0 -2074
  108. package/__tests__/coverage/lcov-report/src/plugin-loader.ts.html +0 -1999
  109. package/__tests__/coverage/lcov-report/src/plugin-registry.ts.html +0 -1897
  110. package/__tests__/coverage/lcov-report/src/plugins/official/hive-mind-plugin.ts.html +0 -1075
  111. package/__tests__/coverage/lcov-report/src/plugins/official/index.html +0 -131
  112. package/__tests__/coverage/lcov-report/src/plugins/official/maestro-plugin.ts.html +0 -1609
  113. package/__tests__/coverage/lcov-report/src/resilience/bulkhead.ts.html +0 -916
  114. package/__tests__/coverage/lcov-report/src/resilience/circuit-breaker.ts.html +0 -1063
  115. package/__tests__/coverage/lcov-report/src/resilience/index.html +0 -161
  116. package/__tests__/coverage/lcov-report/src/resilience/rate-limiter.ts.html +0 -1345
  117. package/__tests__/coverage/lcov-report/src/resilience/retry.ts.html +0 -757
  118. package/__tests__/coverage/lcov-report/src/security/index.html +0 -131
  119. package/__tests__/coverage/lcov-report/src/security/input-validation.ts.html +0 -880
  120. package/__tests__/coverage/lcov-report/src/security/secure-random.ts.html +0 -562
  121. package/__tests__/coverage/lcov-report/src/types/index.html +0 -131
  122. package/__tests__/coverage/lcov-report/src/types/swarm.types.ts.html +0 -850
  123. package/__tests__/coverage/lcov-report/src/types/task.types.ts.html +0 -700
  124. package/__tests__/coverage/lcov-report/src/types.ts.html +0 -1186
  125. package/__tests__/coverage/lcov-report/src/utils/index.html +0 -116
  126. package/__tests__/coverage/lcov-report/src/utils/secure-logger.ts.html +0 -856
  127. package/__tests__/coverage/lcov.info +0 -19877
  128. package/__tests__/coverage/prettify.css +0 -1
  129. package/__tests__/coverage/prettify.js +0 -2
  130. package/__tests__/coverage/sort-arrow-sprite.png +0 -0
  131. package/__tests__/coverage/sorter.js +0 -210
  132. package/__tests__/coverage/src/core/config/defaults.ts.html +0 -706
  133. package/__tests__/coverage/src/core/config/index.html +0 -161
  134. package/__tests__/coverage/src/core/config/loader.ts.html +0 -898
  135. package/__tests__/coverage/src/core/config/schema.ts.html +0 -649
  136. package/__tests__/coverage/src/core/config/validator.ts.html +0 -712
  137. package/__tests__/coverage/src/core/event-bus.ts.html +0 -793
  138. package/__tests__/coverage/src/core/index.html +0 -116
  139. package/__tests__/coverage/src/core/interfaces/event.interface.ts.html +0 -886
  140. package/__tests__/coverage/src/core/interfaces/index.html +0 -116
  141. package/__tests__/coverage/src/core/orchestrator/event-coordinator.ts.html +0 -451
  142. package/__tests__/coverage/src/core/orchestrator/health-monitor.ts.html +0 -727
  143. package/__tests__/coverage/src/core/orchestrator/index.html +0 -176
  144. package/__tests__/coverage/src/core/orchestrator/lifecycle-manager.ts.html +0 -874
  145. package/__tests__/coverage/src/core/orchestrator/session-manager.ts.html +0 -922
  146. package/__tests__/coverage/src/core/orchestrator/task-manager.ts.html +0 -1036
  147. package/__tests__/coverage/src/events/domain-events.ts.html +0 -1837
  148. package/__tests__/coverage/src/events/event-store.ts.html +0 -1849
  149. package/__tests__/coverage/src/events/example-usage.ts.html +0 -964
  150. package/__tests__/coverage/src/events/index.html +0 -176
  151. package/__tests__/coverage/src/events/projections.ts.html +0 -1768
  152. package/__tests__/coverage/src/events/state-reconstructor.ts.html +0 -1132
  153. package/__tests__/coverage/src/events.ts.html +0 -1186
  154. package/__tests__/coverage/src/hooks/example-usage.ts.html +0 -1582
  155. package/__tests__/coverage/src/hooks/executor.ts.html +0 -1222
  156. package/__tests__/coverage/src/hooks/index.html +0 -191
  157. package/__tests__/coverage/src/hooks/registry.ts.html +0 -1084
  158. package/__tests__/coverage/src/hooks/safety/bash-safety.ts.html +0 -1897
  159. package/__tests__/coverage/src/hooks/safety/file-organization.ts.html +0 -1504
  160. package/__tests__/coverage/src/hooks/safety/git-commit.ts.html +0 -1954
  161. package/__tests__/coverage/src/hooks/safety/index.html +0 -146
  162. package/__tests__/coverage/src/hooks/session-hooks.ts.html +0 -1762
  163. package/__tests__/coverage/src/hooks/task-hooks.ts.html +0 -1624
  164. package/__tests__/coverage/src/hooks/types.ts.html +0 -1156
  165. package/__tests__/coverage/src/index.html +0 -176
  166. package/__tests__/coverage/src/mcp/connection-pool.ts.html +0 -1399
  167. package/__tests__/coverage/src/mcp/index.html +0 -176
  168. package/__tests__/coverage/src/mcp/server.ts.html +0 -2407
  169. package/__tests__/coverage/src/mcp/session-manager.ts.html +0 -1369
  170. package/__tests__/coverage/src/mcp/tool-registry.ts.html +0 -1783
  171. package/__tests__/coverage/src/mcp/transport/http.ts.html +0 -1756
  172. package/__tests__/coverage/src/mcp/transport/index.html +0 -146
  173. package/__tests__/coverage/src/mcp/transport/stdio.ts.html +0 -1057
  174. package/__tests__/coverage/src/mcp/transport/websocket.ts.html +0 -1537
  175. package/__tests__/coverage/src/mcp/types.ts.html +0 -1780
  176. package/__tests__/coverage/src/plugin-interface.ts.html +0 -2074
  177. package/__tests__/coverage/src/plugin-loader.ts.html +0 -1999
  178. package/__tests__/coverage/src/plugin-registry.ts.html +0 -1897
  179. package/__tests__/coverage/src/plugins/official/hive-mind-plugin.ts.html +0 -1075
  180. package/__tests__/coverage/src/plugins/official/index.html +0 -131
  181. package/__tests__/coverage/src/plugins/official/maestro-plugin.ts.html +0 -1609
  182. package/__tests__/coverage/src/resilience/bulkhead.ts.html +0 -916
  183. package/__tests__/coverage/src/resilience/circuit-breaker.ts.html +0 -1063
  184. package/__tests__/coverage/src/resilience/index.html +0 -161
  185. package/__tests__/coverage/src/resilience/rate-limiter.ts.html +0 -1345
  186. package/__tests__/coverage/src/resilience/retry.ts.html +0 -757
  187. package/__tests__/coverage/src/security/index.html +0 -131
  188. package/__tests__/coverage/src/security/input-validation.ts.html +0 -880
  189. package/__tests__/coverage/src/security/secure-random.ts.html +0 -562
  190. package/__tests__/coverage/src/types/index.html +0 -131
  191. package/__tests__/coverage/src/types/swarm.types.ts.html +0 -850
  192. package/__tests__/coverage/src/types/task.types.ts.html +0 -700
  193. package/__tests__/coverage/src/types.ts.html +0 -1186
  194. package/__tests__/coverage/src/utils/index.html +0 -116
  195. package/__tests__/coverage/src/utils/secure-logger.ts.html +0 -856
@@ -0,0 +1,117 @@
1
+ [2026-04-28T12:26:56.433Z] RESULT
2
+ ============================================================
3
+ {
4
+ "success": true,
5
+ "output": "# Security Vulnerability Analysis Report\n\nI've analyzed the provided codebase and identified several security vulnerabilities. Here's my detailed assessment:\n\n```json\n{\n \"vulnerabilities\": [\n {\n \"severity\": \"high\",\n \"file\": \"src/core/config/loader.ts\",\n \"line\": 47,\n \"description\": \"Unsafe JSON parsing without size limits. loadJsonConfig() reads files without validating content length, making it vulnerable to denial-of-service attacks via large config files. Could also be exploited by path traversal if config paths are user-controlled.\",\n \"cwe\": \"CWE-400: Uncontrolled Resource Consumption\"\n },\n {\n \"severity\": \"high\",\n \"file\": \"src/core/config/loader.ts\",\n \"line\": 73,\n \"description\": \"Environment variable used in path construction without validation. process.env.HOME could be manipulated to read configs from unintended locations. No symlink attack prevention.\",\n \"cwe\": \"CWE-426: Untrusted Search Path\"\n },\n {\n \"severity\": \"high\",\n \"file\": \"src/core/config/loader.ts\",\n \"line\": 90,\n \"description\": \"Integer overflow risk: process.env.CLAUDE_FLOW_MAX_AGENTS and CLAUDE_FLOW_MCP_PORT are parsed without bounds checking. No validation that values are within safe ranges.\",\n \"cwe\": \"CWE-190: Integer Overflow or Wraparound\"\n },\n {\n \"severity\": \"medium\",\n \"file\": \"src/utils/secure-logger.js\",\n \"line\": 45,\n \"description\": \"Regex-based redaction is insufficient. Pattern `/[a-zA-Z0-9+/]{40,}={0,2}/g` for detecting base64 keys may match legitimate content and cause false positives/negatives. Legitimate base64 strings could be incorrectly redacted.\",\n \"cwe\": \"CWE-1104: Use of Unmaintained Third Party Components\"\n },\n {\n \"severity\": \"medium\",\n \"file\": \"src/utils/secure-logger.js\",\n \"line\": 64,\n \"description\": \"Missing circular reference handling in sanitizeObject(). Recursive object sanitization without cycle detection could cause stack overflow on circular data structures.\",\n \"cwe\": \"CWE-674: Uncontrolled Recursion\"\n },\n {\n \"severity\": \"medium\",\n \"file\": \"src/core/event-bus.ts\",\n \"line\": 90,\n \"description\": \"No input validation on event payloads. Events are dispatched with arbitrary payloads without type checking or sanitization. Could allow injection attacks through event data.\",\n \"cwe\": \"CWE-20: Improper Input Validation\"\n },\n {\n \"severity\": \"medium\",\n \"file\": \"src/core/event-bus.ts\",\n \"line\": 110,\n \"description\": \"Async error handling doesn't prevent further event processing. Errors in async event handlers are logged but don't propagate, potentially hiding security issues.\",\n \"cwe\": \"CWE-248: Uncaught Exception\"\n },\n {\n \"severity\": \"medium\",\n \"file\": \"src/core/interfaces/memory.interface.ts\",\n \"line\": 15,\n \"description\": \"Arbitrary value storage without encryption. IMemoryEntry stores values without encryption or sanitization. Sensitive data (tokens, passwords) could be exposed if memory backend is compromised.\",\n \"cwe\": \"CWE-312: Cleartext Storage of Sensitive Information\"\n },\n {\n \"severity\": \"medium\",\n \"file\": \"src/core/interfaces/task.interface.ts\",\n \"line\": 25,\n \"description\": \"Error objects stored directly without sanitization. Task errors could contain sensitive stack traces or system information even with secure logger present.\",\n \"cwe\": \"CWE-209: Information Exposure Through an Error Message\"\n },\n {\n \"severity\": \"low\",\n \"file\": \"src/core/interfaces/agent.interface.ts\",\n \"line\": 26,\n \"description\": \"No field size limits on agent metadata. Arbitrary metadata objects could grow unbounded, causing memory exhaustion.\",\n \"cwe\": \"CWE-400: Uncontrolled Resource Consumption\"\n },\n {\n \"severity\": \"low\",\n \"file\": \"src/core/config/loader.ts\",\n \"line\": 88,\n \"description\": \"No validation of topology string enum values. While Zod schemas validate, the direct assignment from environment variables could bypass schema validation if not properly integrated.\",\n \"cwe\": \"CWE-116: Improper Encoding or Escaping of Output\"\n },\n {\n \"severity\": \"low\",\n \"file\": \"src/utils/secure-logger.js\",\n \"line\": 72,\n \"description\": \"Path sanitization regex may not cover all sensitive paths. Windows UNC paths and network locations are not handled.\",\n \"cwe\": \"CWE-200: Exposure of Sensitive Information to an Unauthorized Actor\"\n }\n ],\n \"riskScore\": 68,\n \"recommendations\": [\n \"Implement file size limits in loadJsonConfig() - maximum 1MB for config files, validate before parsing\",\n \"Add path validation in ConfigLoader - use path.resolve() with validation against a whitelist of allowed directories, check for symlinks with fs.realpathSync()\",\n \"Validate all environment variables at startup - use strict bounds checking (0 < CLAUDE_FLOW_MAX_AGENTS <= 1000, port 1024-65535)\",\n \"Replace regex-based sanitization with dedicated security library (e.g., @snyk/protect) or use a whitelist approach for known sensitive patterns\",\n \"Add WeakMap-based circular reference tracking to sanitizeObject() to prevent infinite recursion\",\n \"Implement strict event payload validation - use TypeScript interfaces + runtime validation (Zod) for all event types\",\n \"Add rate limiting to EventBus.emit() to prevent event flooding/DoS attacks\",\n \"Encrypt sensitive data in memory - use crypto.subtle for in-memory encryption of password/token/secret fields\",\n \"Sanitize error objects before storing in tasks - use secure-logger for all error handling\",\n \"Add resource quotas - implement maximum sizes for metadata objects, task inputs/outputs (e.g., 10MB limit)\",\n \"Validate UUID/ID formats with strict regex patterns to prevent injection\",\n \"Update path sanitization regex to handle Windows UNC paths: `/^\\\\\\\\\\\\\\\\[^\\\\\\\\]+\\\\\\\\[^\\\\\\\\]+/`\",\n \"Add comprehensive security audit logging - log all configuration loads, environment variable access, sensitive data sanitization events\",\n \"Implement secrets scanning in pre-commit hooks to prevent accidental commits of API keys/credentials\"\n ]\n}\n```\n\n## Key Findings Summary\n\n**Critical Areas:**\n- **Configuration Loading**: Lacks input validation and bounds checking\n- **Environment Variables**: Not sanitized or validated before use\n- **Data Sanitization**: Regex-based approach is brittle and insufficient\n- **Memory Storage**: No encryption for sensitive data\n\n**Recommendations Priority:**\n1. ⚠️ Implement strict file size and path validation in config loader\n2. ⚠️ Validate all environment variable inputs with bounds checking\n3. ⚠️ Add circular reference detection to prevent DoS via deep objects\n4. ⚠️ Encrypt sensitive data in memory backend\n\nThe codebase has good security-conscious design (secure logger, sanitization functions), but implementation gaps could lead to information disclosure and DoS vulnerabilities.\n",
6
+ "parsedOutput": {
7
+ "vulnerabilities": [
8
+ {
9
+ "severity": "high",
10
+ "file": "src/core/config/loader.ts",
11
+ "line": 47,
12
+ "description": "Unsafe JSON parsing without size limits. loadJsonConfig() reads files without validating content length, making it vulnerable to denial-of-service attacks via large config files. Could also be exploited by path traversal if config paths are user-controlled.",
13
+ "cwe": "CWE-400: Uncontrolled Resource Consumption"
14
+ },
15
+ {
16
+ "severity": "high",
17
+ "file": "src/core/config/loader.ts",
18
+ "line": 73,
19
+ "description": "Environment variable used in path construction without validation. process.env.HOME could be manipulated to read configs from unintended locations. No symlink attack prevention.",
20
+ "cwe": "CWE-426: Untrusted Search Path"
21
+ },
22
+ {
23
+ "severity": "high",
24
+ "file": "src/core/config/loader.ts",
25
+ "line": 90,
26
+ "description": "Integer overflow risk: process.env.CLAUDE_FLOW_MAX_AGENTS and CLAUDE_FLOW_MCP_PORT are parsed without bounds checking. No validation that values are within safe ranges.",
27
+ "cwe": "CWE-190: Integer Overflow or Wraparound"
28
+ },
29
+ {
30
+ "severity": "medium",
31
+ "file": "src/utils/secure-logger.js",
32
+ "line": 45,
33
+ "description": "Regex-based redaction is insufficient. Pattern `/[a-zA-Z0-9+/]{40,}={0,2}/g` for detecting base64 keys may match legitimate content and cause false positives/negatives. Legitimate base64 strings could be incorrectly redacted.",
34
+ "cwe": "CWE-1104: Use of Unmaintained Third Party Components"
35
+ },
36
+ {
37
+ "severity": "medium",
38
+ "file": "src/utils/secure-logger.js",
39
+ "line": 64,
40
+ "description": "Missing circular reference handling in sanitizeObject(). Recursive object sanitization without cycle detection could cause stack overflow on circular data structures.",
41
+ "cwe": "CWE-674: Uncontrolled Recursion"
42
+ },
43
+ {
44
+ "severity": "medium",
45
+ "file": "src/core/event-bus.ts",
46
+ "line": 90,
47
+ "description": "No input validation on event payloads. Events are dispatched with arbitrary payloads without type checking or sanitization. Could allow injection attacks through event data.",
48
+ "cwe": "CWE-20: Improper Input Validation"
49
+ },
50
+ {
51
+ "severity": "medium",
52
+ "file": "src/core/event-bus.ts",
53
+ "line": 110,
54
+ "description": "Async error handling doesn't prevent further event processing. Errors in async event handlers are logged but don't propagate, potentially hiding security issues.",
55
+ "cwe": "CWE-248: Uncaught Exception"
56
+ },
57
+ {
58
+ "severity": "medium",
59
+ "file": "src/core/interfaces/memory.interface.ts",
60
+ "line": 15,
61
+ "description": "Arbitrary value storage without encryption. IMemoryEntry stores values without encryption or sanitization. Sensitive data (tokens, passwords) could be exposed if memory backend is compromised.",
62
+ "cwe": "CWE-312: Cleartext Storage of Sensitive Information"
63
+ },
64
+ {
65
+ "severity": "medium",
66
+ "file": "src/core/interfaces/task.interface.ts",
67
+ "line": 25,
68
+ "description": "Error objects stored directly without sanitization. Task errors could contain sensitive stack traces or system information even with secure logger present.",
69
+ "cwe": "CWE-209: Information Exposure Through an Error Message"
70
+ },
71
+ {
72
+ "severity": "low",
73
+ "file": "src/core/interfaces/agent.interface.ts",
74
+ "line": 26,
75
+ "description": "No field size limits on agent metadata. Arbitrary metadata objects could grow unbounded, causing memory exhaustion.",
76
+ "cwe": "CWE-400: Uncontrolled Resource Consumption"
77
+ },
78
+ {
79
+ "severity": "low",
80
+ "file": "src/core/config/loader.ts",
81
+ "line": 88,
82
+ "description": "No validation of topology string enum values. While Zod schemas validate, the direct assignment from environment variables could bypass schema validation if not properly integrated.",
83
+ "cwe": "CWE-116: Improper Encoding or Escaping of Output"
84
+ },
85
+ {
86
+ "severity": "low",
87
+ "file": "src/utils/secure-logger.js",
88
+ "line": 72,
89
+ "description": "Path sanitization regex may not cover all sensitive paths. Windows UNC paths and network locations are not handled.",
90
+ "cwe": "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
91
+ }
92
+ ],
93
+ "riskScore": 68,
94
+ "recommendations": [
95
+ "Implement file size limits in loadJsonConfig() - maximum 1MB for config files, validate before parsing",
96
+ "Add path validation in ConfigLoader - use path.resolve() with validation against a whitelist of allowed directories, check for symlinks with fs.realpathSync()",
97
+ "Validate all environment variables at startup - use strict bounds checking (0 < CLAUDE_FLOW_MAX_AGENTS <= 1000, port 1024-65535)",
98
+ "Replace regex-based sanitization with dedicated security library (e.g., @snyk/protect) or use a whitelist approach for known sensitive patterns",
99
+ "Add WeakMap-based circular reference tracking to sanitizeObject() to prevent infinite recursion",
100
+ "Implement strict event payload validation - use TypeScript interfaces + runtime validation (Zod) for all event types",
101
+ "Add rate limiting to EventBus.emit() to prevent event flooding/DoS attacks",
102
+ "Encrypt sensitive data in memory - use crypto.subtle for in-memory encryption of password/token/secret fields",
103
+ "Sanitize error objects before storing in tasks - use secure-logger for all error handling",
104
+ "Add resource quotas - implement maximum sizes for metadata objects, task inputs/outputs (e.g., 10MB limit)",
105
+ "Validate UUID/ID formats with strict regex patterns to prevent injection",
106
+ "Update path sanitization regex to handle Windows UNC paths: `/^\\\\\\\\[^\\\\]+\\\\[^\\\\]+/`",
107
+ "Add comprehensive security audit logging - log all configuration loads, environment variable access, sensitive data sanitization events",
108
+ "Implement secrets scanning in pre-commit hooks to prevent accidental commits of API keys/credentials"
109
+ ]
110
+ },
111
+ "durationMs": 29461,
112
+ "model": "haiku",
113
+ "sandboxMode": "strict",
114
+ "workerType": "audit",
115
+ "timestamp": "2026-04-28T12:26:56.433Z",
116
+ "executionId": "audit_1777379186972_h5un5x"
117
+ }