@claude-flow/cli 3.38.11 → 3.38.13

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 (144) hide show
  1. package/.claude/.proven-config-version +1 -0
  2. package/.claude/helpers/.helpers-version +1 -1
  3. package/.claude/helpers/helpers.manifest.json +2 -2
  4. package/.claude/helpers/statusline.cjs +0 -0
  5. package/.claude/proven-config.json +42 -0
  6. package/catalog-manifest.json +4 -4
  7. package/dist/src/commands/hooks.js +3 -2
  8. package/dist/src/init/executor.d.ts +6 -0
  9. package/dist/src/init/executor.js +5 -3
  10. package/dist/src/init/settings-generator.js +6 -2
  11. package/dist/src/mcp-tools/hooks-tools.js +6 -1
  12. package/dist/src/ruvector/lattice-wasm.d.ts +14 -0
  13. package/dist/src/ruvector/lattice-wasm.js +144 -0
  14. package/dist/src/services/flywheel-receipt.d.ts +10 -0
  15. package/dist/src/services/flywheel-receipt.js +82 -7
  16. package/dist/src/services/flywheel-transaction.js +10 -1
  17. package/node_modules/@claude-flow/codex/dist/cli.js +0 -0
  18. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +0 -0
  19. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +6 -6
  20. package/package.json +1 -1
  21. package/plugins/ruflo-metaharness/.claude-flow/daemon-state.json +178 -0
  22. package/plugins/ruflo-metaharness/.claude-flow/daemon.pid +1 -0
  23. package/plugins/ruflo-metaharness/.claude-flow/data/pending-insights.jsonl +5 -0
  24. package/plugins/ruflo-metaharness/.claude-flow/logs/daemon.log +269 -0
  25. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783604774864_ozbujc_prompt.log +19 -0
  26. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783604774864_ozbujc_result.log +108 -0
  27. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783605513587_ulvmpb_prompt.log +19 -0
  28. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783605513587_ulvmpb_result.log +209 -0
  29. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783606368867_ahysui_prompt.log +19 -0
  30. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783606368867_ahysui_result.log +192 -0
  31. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783607120257_lh05rb_prompt.log +19 -0
  32. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783607120257_lh05rb_result.log +13 -0
  33. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783608020362_j3096j_prompt.log +19 -0
  34. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783608020362_j3096j_result.log +120 -0
  35. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783608776347_261b61_prompt.log +19 -0
  36. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783608776347_261b61_result.log +85 -0
  37. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783609621359_s5i6ye_prompt.log +19 -0
  38. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783609621359_s5i6ye_result.log +13 -0
  39. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783610087998_qihv9v_prompt.log +19 -0
  40. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783610087998_qihv9v_result.log +17 -0
  41. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783610773920_qlzmxo_prompt.log +19 -0
  42. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783610773920_qlzmxo_result.log +17 -0
  43. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783611376090_xpqf1z_prompt.log +19 -0
  44. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783611376090_xpqf1z_result.log +16 -0
  45. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783612097184_9rqfor_prompt.log +19 -0
  46. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783612097184_9rqfor_result.log +138 -0
  47. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783612811574_4u602j_prompt.log +19 -0
  48. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783612811574_4u602j_result.log +16 -0
  49. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783613750487_a46ttn_prompt.log +19 -0
  50. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783613750487_a46ttn_result.log +107 -0
  51. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783614289360_figwc0_prompt.log +19 -0
  52. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783614289360_figwc0_result.log +200 -0
  53. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783615067640_l7tm6a_prompt.log +19 -0
  54. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783615067640_l7tm6a_result.log +54 -0
  55. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783615825308_44nor5_prompt.log +19 -0
  56. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783615825308_44nor5_result.log +85 -0
  57. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783616524771_ut1ftw_prompt.log +19 -0
  58. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783616524771_ut1ftw_result.log +266 -0
  59. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783617323039_fs3x5a_prompt.log +19 -0
  60. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783617323039_fs3x5a_result.log +56 -0
  61. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783618049184_1f4yah_prompt.log +19 -0
  62. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783618049184_1f4yah_result.log +96 -0
  63. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783618793925_4ee7tf_prompt.log +19 -0
  64. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783618793925_4ee7tf_result.log +481 -0
  65. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783619642574_yjr4mm_prompt.log +19 -0
  66. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783619642574_yjr4mm_result.log +104 -0
  67. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783620392771_oduto0_prompt.log +19 -0
  68. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783620392771_oduto0_result.log +148 -0
  69. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783621183670_gd0p1x_prompt.log +19 -0
  70. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783621183670_gd0p1x_result.log +111 -0
  71. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783621738388_z4k48b_prompt.log +19 -0
  72. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783621738388_z4k48b_result.log +89 -0
  73. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783622493677_zwc35w_prompt.log +19 -0
  74. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783622493677_zwc35w_result.log +207 -0
  75. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783604894861_v6n3ut_prompt.log +14 -0
  76. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783604894861_v6n3ut_result.log +66 -0
  77. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783605934532_9h8ikb_prompt.log +14 -0
  78. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783605934532_9h8ikb_result.log +68 -0
  79. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783607181736_t12f4y_prompt.log +14 -0
  80. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783607181736_t12f4y_result.log +78 -0
  81. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783608341266_zhk0fl_prompt.log +14 -0
  82. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783608341266_zhk0fl_result.log +68 -0
  83. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783609420180_7xw817_prompt.log +14 -0
  84. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783609420180_7xw817_result.log +72 -0
  85. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783610535307_2pxofp_prompt.log +14 -0
  86. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783610535307_2pxofp_result.log +17 -0
  87. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783611437445_ofwnpb_prompt.log +14 -0
  88. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783611437445_ofwnpb_result.log +60 -0
  89. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783612556827_1cb112_prompt.log +14 -0
  90. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783612556827_1cb112_result.log +56 -0
  91. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783613579531_18xiax_prompt.log +14 -0
  92. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783613579531_18xiax_result.log +74 -0
  93. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783614650481_2zdz7w_prompt.log +14 -0
  94. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783614650481_2zdz7w_result.log +68 -0
  95. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783615742328_rjj69d_prompt.log +14 -0
  96. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783615742328_rjj69d_result.log +65 -0
  97. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783616767230_1iad99_prompt.log +14 -0
  98. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783616767230_1iad99_result.log +68 -0
  99. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783617783537_rqagku_prompt.log +14 -0
  100. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783617783537_rqagku_result.log +56 -0
  101. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783618817343_r1lbhr_prompt.log +14 -0
  102. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783618817343_r1lbhr_result.log +65 -0
  103. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783619907773_8msfw3_prompt.log +14 -0
  104. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783619907773_8msfw3_result.log +77 -0
  105. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783621009302_hybdum_prompt.log +14 -0
  106. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783621009302_hybdum_result.log +64 -0
  107. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783622083681_nznpnx_prompt.log +14 -0
  108. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783622083681_nznpnx_result.log +56 -0
  109. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783623208340_olsbaw_prompt.log +14 -0
  110. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783605134860_9jssz9_prompt.log +14 -0
  111. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783605134860_9jssz9_result.log +69 -0
  112. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783606516743_zftbaa_prompt.log +14 -0
  113. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783606516743_zftbaa_result.log +92 -0
  114. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783608038317_jrd66e_prompt.log +14 -0
  115. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783608038317_jrd66e_result.log +92 -0
  116. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783609388416_mc3zoe_prompt.log +14 -0
  117. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783609388416_mc3zoe_result.log +82 -0
  118. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783610821384_tzqvlb_prompt.log +14 -0
  119. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783610821384_tzqvlb_result.log +17 -0
  120. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783612023285_buygpo_prompt.log +14 -0
  121. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783612023285_buygpo_result.log +57 -0
  122. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783613599301_6f78cw_prompt.log +14 -0
  123. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783613599301_6f78cw_result.log +60 -0
  124. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783615000844_v95ues_prompt.log +14 -0
  125. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783615000844_v95ues_result.log +69 -0
  126. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783616341693_bl5d9o_prompt.log +14 -0
  127. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783616341693_bl5d9o_result.log +64 -0
  128. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783617832831_ha6s8d_prompt.log +14 -0
  129. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783617832831_ha6s8d_result.log +42 -0
  130. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783619384959_s5iiwf_prompt.log +14 -0
  131. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783619384959_s5iiwf_result.log +47 -0
  132. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783620946263_d7ovai_prompt.log +14 -0
  133. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783620946263_d7ovai_result.log +52 -0
  134. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783622473846_t839e5_prompt.log +14 -0
  135. package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783622473846_t839e5_result.log +96 -0
  136. package/plugins/ruflo-metaharness/.claude-flow/metrics/backup.json +7 -0
  137. package/plugins/ruflo-metaharness/.claude-flow/metrics/codebase-map.json +11 -0
  138. package/plugins/ruflo-metaharness/.claude-flow/metrics/consolidation.json +16 -0
  139. package/plugins/ruflo-metaharness/.claude-flow/metrics/harness-loop.json +83 -0
  140. package/plugins/ruflo-metaharness/.claude-flow/metrics/performance.json +55 -0
  141. package/plugins/ruflo-metaharness/.claude-flow/metrics/security-audit.json +206 -0
  142. package/plugins/ruflo-metaharness/.claude-flow/metrics/test-gaps.json +95 -0
  143. package/plugins/ruflo-metaharness/.claude-flow/neural/stats.json +6 -0
  144. package/plugins/ruflo-metaharness/skills/harness-gepa/SKILL.md +1 -1
@@ -0,0 +1,481 @@
1
+ [2026-07-09T17:44:02.531Z] RESULT
2
+ ============================================================
3
+ {
4
+ "success": true,
5
+ "output": "Perfect! Both agents have completed their analysis. Now let me synthesize the comprehensive security audit report:\n\n```json\n{\n \"audit_metadata\": {\n \"project\": \"ruflo-metaharness\",\n \"path\": \"/Users/cohen/Projects/ruflo/plugins/ruflo-metaharness\",\n \"scan_date\": \"2026-07-09\",\n \"analyzer\": \"multi-agent-security-audit\",\n \"codebase_type\": \"npm plugin - subprocess-based CLI wrapper\",\n \"total_files_scanned\": 32,\n \"scripts_analyzed\": 32,\n \"risk_score\": 67,\n \"risk_level\": \"MEDIUM-HIGH\"\n },\n \"vulnerabilities\": [\n {\n \"id\": \"VULN-001\",\n \"severity\": \"critical\",\n \"category\": \"command-injection\",\n \"file\": \"scripts/_darwin.mjs\",\n \"line\": 80,\n \"title\": \"Command Injection via npx -y Without Version Pinning\",\n \"description\": \"Uses 'npx -y -p DARWIN_PIN metaharness-darwin' which allows arbitrary npm package execution. If a compromised version (0.8.1, 0.8.2, etc.) is published, all users auto-install malicious code. This is a supply chain attack vector.\",\n \"code_snippet\": \"npx -y -p DARWIN_PIN metaharness-darwin ...\",\n \"attack_vector\": \"Malicious npm package published as patch update. User runs command → npm installs compromised version → arbitrary code execution\",\n \"impact\": \"Remote code execution on developer machines running ruflo commands\",\n \"recommendation\": \"Migrate from npx -y to the versioned cache install pattern used in _redblue.mjs and _harness.mjs. Pin exact version in cache directory, validate checksum before execution.\",\n \"cwe\": \"CWE-94: Improper Control of Generation of Code ('Code Injection')\",\n \"cvss_vector\": \"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H\",\n \"cvss_score\": 8.8\n },\n {\n \"id\": \"VULN-002\",\n \"severity\": \"critical\",\n \"category\": \"path-traversal\",\n \"file\": \"scripts/drift-from-history.mjs\",\n \"line\": 172,\n \"title\": \"Path Traversal in --baseline-file Argument\",\n \"description\": \"The --baseline-file argument is not validated before use. Users can specify '../../../etc/passwd' or other arbitrary file paths to read system files.\",\n \"code_snippet\": \"// baseline-file argument passed without validation\\nconst baselineFile = options['baseline-file']; // No path.resolve() or validation\\n\",\n \"attack_vector\": \"Attacker specifies: ruflo metaharness drift-from-history --baseline-file ../../../../etc/passwd\",\n \"impact\": \"Arbitrary file read access on the system, exposure of sensitive files\",\n \"recommendation\": \"1. Validate file paths with path.resolve()\\n2. Reject paths containing '..'\\n3. Enforce directory whitelists\\n4. Use path.relative() to verify file is within expected directory\",\n \"cwe\": \"CWE-22: Improper Limitation of a Pathname to a Restricted Directory\",\n \"cvss_vector\": \"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N\",\n \"cvss_score\": 5.7\n },\n {\n \"id\": \"VULN-003\",\n \"severity\": \"critical\",\n \"category\": \"environment-variable-injection\",\n \"file\": \"scripts/oia-audit.mjs\",\n \"line\": 36,\n \"title\": \"Environment Variable Injection - CLI_CORE/CLI_PKG Not Validated\",\n \"description\": \"Environment variables CLI_CORE and CLI_PKG are constructed directly from process.env without whitelist validation. Attackers can inject different npm packages or memory namespaces by setting these variables.\",\n \"affected_files\": [\n \"scripts/oia-audit.mjs:36\",\n \"scripts/audit-list.mjs:22\",\n \"scripts/audit-trend.mjs:38\"\n ],\n \"code_snippet\": \"const CLI_PKG = process.env.CLI_PKG || '@claude-flow/cli';\\n// No validation that CLI_PKG is actually @claude-flow/cli or similar\",\n \"attack_vector\": \"export CLI_PKG='malicious-package@latest' && ruflo metaharness oia-audit\",\n \"impact\": \"Execution of malicious npm packages in the critical audit pipeline, potential data theft or system compromise\",\n \"recommendation\": \"Implement strict whitelist validation:\\n1. Only allow: '@claude-flow/cli', '@claude-flow/cli-core'\\n2. Use exact version pins, reject @latest\\n3. Validate namespace names (alphanumeric + hyphen only)\\n4. Log rejected env vars for monitoring\",\n \"cwe\": \"CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code\",\n \"cvss_vector\": \"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H\",\n \"cvss_score\": 7.8\n },\n {\n \"id\": \"VULN-004\",\n \"severity\": \"high\",\n \"category\": \"dependency-vulnerability\",\n \"file\": \"scripts/_darwin.mjs\",\n \"line\": 50,\n \"title\": \"Tilde-Range Version Pinning Allows Patch Exploitation\",\n \"description\": \"Uses ~0.8.0 instead of exact 0.8.0, allowing automatic patch updates. If 0.8.1 is compromised, users auto-update to malicious version.\",\n \"affected_locations\": [\n \"scripts/_darwin.mjs:50 (~0.8.0)\",\n \"scripts/_redblue.mjs:63 (~0.1.4)\",\n \"scripts/_harness.mjs:59 (~0.3.0)\"\n ],\n \"code_snippet\": \"const DARWIN_PIN = '0.8.0';\\nconst versionRange = `~${DARWIN_PIN}`; // Expands to >=0.8.0 <0.9.0\",\n \"impact\": \"Supply chain attack - compromised patch version bypasses security reviews\",\n \"recommendation\": \"Use exact version pinning (e.g., 0.8.0 not ~0.8.0). Create explicit update process with security review before bumping versions.\",\n \"cwe\": \"CWE-1104: Use of Unmaintained Third Party Components\",\n \"cvss_vector\": \"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H\",\n \"cvss_score\": 8.8\n },\n {\n \"id\": \"VULN-005\",\n \"severity\": \"high\",\n \"category\": \"dependency-vulnerability\",\n \"file\": \"scripts/test-with-openrouter.mjs\",\n \"line\": 109,\n \"title\": \"@latest Version Pinning in Test - Highest Supply Chain Risk\",\n \"description\": \"Uses 'npx -y metaharness@latest' which fetches arbitrary versions without pinning. Every invocation could retrieve malicious code.\",\n \"code_snippet\": \"const result = execSync('npx -y metaharness@latest --version');\\n\",\n \"impact\": \"HIGHEST supply chain attack risk - every test execution could be compromised\",\n \"recommendation\": \"Pin to exact version: metaharness@0.3.0, not @latest. Update version only after security review and testing.\",\n \"cwe\": \"CWE-1104: Use of Unmaintained Third Party Components\",\n \"cvss_vector\": \"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H\",\n \"cvss_score\": 8.8\n },\n {\n \"id\": \"VULN-006\",\n \"severity\": \"high\",\n \"category\": \"command-injection\",\n \"file\": \"scripts/test-with-openrouter.mjs\",\n \"line\": 65,\n \"title\": \"Command Injection in gcloud Secrets Retrieval\",\n \"description\": \"Variable secretName is embedded directly in gcloud command without proper escaping: execSync(`gcloud secrets versions access latest --secret=${secretName}`). If secretName contains shell metacharacters, arbitrary commands execute.\",\n \"code_snippet\": \"const secretValue = execSync(`gcloud secrets versions access latest --secret=${secretName}`);\\n\",\n \"attack_vector\": \"secretName = 'X; rm -rf /; #' → execSync executes rm command\",\n \"impact\": \"Arbitrary command execution on the system\",\n \"recommendation\": \"1. Use spawn() with array arguments instead of execSync with string interpolation\\n2. Or properly escape secretName with shellEscape library\\n3. Example: spawn('gcloud', ['secrets', 'versions', 'access', 'latest', '--secret=' + secretName])\",\n \"cwe\": \"CWE-78: Improper Neutralization of Special Elements used in an OS Command\",\n \"cvss_vector\": \"CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H\",\n \"cvss_score\": 7.4\n },\n {\n \"id\": \"VULN-007\",\n \"severity\": \"medium\",\n \"category\": \"network-security\",\n \"file\": \"scripts/test-with-openrouter.mjs\",\n \"line\": 76,\n \"title\": \"No HTTPS Certificate Pinning or Validation\",\n \"description\": \"Hardcoded HTTPS endpoint 'https://openrouter.ai/api/v1/models' has no certificate pinning or response validation. Vulnerable to MITM attacks if DNS is compromised.\",\n \"code_snippet\": \"const modelsResponse = await fetch('https://openrouter.ai/api/v1/models');\\n\",\n \"impact\": \"MITM attack redirects to malicious server, API key theft, data interception\",\n \"recommendation\": \"1. Add response validation and integrity checks\\n2. Consider TLS certificate pinning using node-tls-client or similar\\n3. Validate response schema and signatures\\n4. Add certificate transparency checks\",\n \"cwe\": \"CWE-295: Improper Certificate Validation\",\n \"cvss_vector\": \"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N\",\n \"cvss_score\": 6.9\n },\n {\n \"id\": \"VULN-008\",\n \"severity\": \"medium\",\n \"category\": \"information-disclosure\",\n \"file\": \"scripts/test-with-openrouter.mjs\",\n \"line\": 92,\n \"title\": \"Hardcoded HTTP Headers Aid Fingerprinting\",\n \"description\": \"Fixed User-Agent and Referer headers are hardcoded, enabling targeted attacks and fingerprinting of ruflo users.\",\n \"code_snippet\": \"headers: {\\n 'User-Agent': 'ruflo-metaharness-integration',\\n 'HTTP-Referer': 'https://github.com/ruvnet/ruflo'\\n}\\n\",\n \"impact\": \"Enables identification and targeting of ruflo users, fingerprinting for attacks\",\n \"recommendation\": \"1. Make headers configurable via environment variables\\n2. Randomize User-Agent\\n3. Use generic headers that don't identify the tool\",\n \"cwe\": \"CWE-200: Exposure of Sensitive Information to an Unauthorized Actor\",\n \"cvss_vector\": \"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N\",\n \"cvss_score\": 5.3\n },\n {\n \"id\": \"VULN-009\",\n \"severity\": \"medium\",\n \"category\": \"path-traversal\",\n \"file\": \"scripts/evolve.mjs\",\n \"line\": 114,\n \"title\": \"Incomplete Path Validation in --repo Argument\",\n \"description\": \"The --repo argument is checked for existence but not fully validated for path traversal. Error handling incomplete.\",\n \"code_snippet\": \"if (!fs.existsSync(repoPath)) {\\n return { error: 'Repository not found' };\\n}\\n// Missing: path.resolve() normalization, rejection of .., leading slashes\",\n \"impact\": \"Potential path traversal if error handling is bypassed\",\n \"recommendation\": \"1. Use path.resolve() to normalize paths\\n2. Verify normalized path is within expected directory\\n3. Reject paths containing '..'\\n4. Reject absolute paths or symlinks outside project\",\n \"cwe\": \"CWE-22: Improper Limitation of a Pathname to a Restricted Directory\",\n \"cvss_vector\": \"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L\",\n \"cvss_score\": 4.7\n },\n {\n \"id\": \"VULN-010\",\n \"severity\": \"medium\",\n \"category\": \"information-disclosure\",\n \"file\": \"scripts/test-with-openrouter.mjs\",\n \"line\": 144,\n \"title\": \"API Key Partially Logged to Console\",\n \"description\": \"API key is logged with prefix visible: console.log(key.slice(0, 7) + '…'). Even partial keys can be used in replay attacks or help attackers guess full keys.\",\n \"code_snippet\": \"console.log('API Key:', apiKey.slice(0, 7) + '…');\\n\",\n \"impact\": \"API key leaked in logs, bug reports, screenshots, CI logs\",\n \"recommendation\": \"Don't log any part of the API key, only its length:\\nconsole.log('API Key length:', apiKey.length);\",\n \"cwe\": \"CWE-532: Insertion of Sensitive Information into Log File\",\n \"cvss_vector\": \"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N\",\n \"cvss_score\": 5.7\n },\n {\n \"id\": \"VULN-011\",\n \"severity\": \"low\",\n \"category\": \"authentication\",\n \"file\": \"scripts/test-with-openrouter.mjs\",\n \"line\": 87,\n \"title\": \"API Key Passed via Environment Variable Without Validation\",\n \"description\": \"API key from GCP Secret Manager is not validated for format or length before use. Could accept empty or invalid keys silently.\",\n \"code_snippet\": \"const apiKey = execSync(`gcloud secrets versions access latest --secret=OPENROUTER_API_KEY`).toString().trim();\\nif (!apiKey) throw new Error('...');\\n// Missing: format validation, length check, pattern matching\",\n \"impact\": \"Invalid credentials could cause unexpected behavior or reveal secrets in error messages\",\n \"recommendation\": \"Add validation:\\nif (!apiKey || !apiKey.match(/^sk-[a-zA-Z0-9_-]{40,}/)) throw new Error('Invalid key format');\",\n \"cwe\": \"CWE-347: Improper Verification of Cryptographic Signature\",\n \"cvss_vector\": \"CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:L\",\n \"cvss_score\": 3.4\n }\n ],\n \"summary\": {\n \"total_vulnerabilities\": 11,\n \"critical\": 3,\n \"high\": 3,\n \"medium\": 4,\n \"low\": 1,\n \"risk_score\": 67,\n \"risk_level\": \"MEDIUM-HIGH\"\n },\n \"vulnerability_distribution\": {\n \"command_injection\": 3,\n \"path_traversal\": 2,\n \"environment_variable_injection\": 1,\n \"dependency_vulnerabilities\": 2,\n \"network_security\": 1,\n \"information_disclosure\": 1,\n \"authentication\": 1\n },\n \"affected_files\": {\n \"scripts/_darwin.mjs\": [\"VULN-001\", \"VULN-004\"],\n \"scripts/drift-from-history.mjs\": [\"VULN-002\"],\n \"scripts/oia-audit.mjs\": [\"VULN-003\"],\n \"scripts/audit-list.mjs\": [\"VULN-003\"],\n \"scripts/audit-trend.mjs\": [\"VULN-003\"],\n \"scripts/_redblue.mjs\": [\"VULN-004\"],\n \"scripts/_harness.mjs\": [\"VULN-004\"],\n \"scripts/test-with-openrouter.mjs\": [\"VULN-005\", \"VULN-006\", \"VULN-007\", \"VULN-008\", \"VULN-010\", \"VULN-011\"],\n \"scripts/evolve.mjs\": [\"VULN-009\"]\n },\n \"recommendations\": [\n {\n \"priority\": \"critical\",\n \"category\": \"supply-chain-security\",\n \"title\": \"Eliminate @latest and Tilde-Range Version Pinning\",\n \"description\": \"Migrate from ~0.3.0 and @latest to exact version pins (0.3.0). This prevents automatic installation of compromised patch updates.\",\n \"affected_vulnerabilities\": [\"VULN-001\", \"VULN-004\", \"VULN-005\"],\n \"implementation_effort\": \"LOW\",\n \"timeline\": \"IMMEDIATE\"\n },\n {\n \"priority\": \"critical\",\n \"category\": \"input-validation\",\n \"title\": \"Implement Path Traversal Defense Across All File Operations\",\n \"description\": \"Add path.resolve() validation and '..' rejection to all file argument handlers (drift-from-history.mjs, evolve.mjs)\",\n \"affected_vulnerabilities\": [\"VULN-002\", \"VULN-009\"],\n \"implementation_effort\": \"LOW\",\n \"timeline\": \"IMMEDIATE\"\n },\n {\n \"priority\": \"critical\",\n \"category\": \"environment-security\",\n \"title\": \"Whitelist Environment Variable Values\",\n \"description\": \"Validate CLI_PKG and CLI_CORE against whitelist. Only allow official @claude-flow packages with exact versions.\",\n \"affected_vulnerabilities\": [\"VULN-003\"],\n \"implementation_effort\": \"MEDIUM\",\n \"timeline\": \"IMMEDIATE\"\n },\n {\n \"priority\": \"high\",\n \"category\": \"command-injection-prevention\",\n \"title\": \"Replace execSync String Interpolation with spawn()\",\n \"description\": \"Convert all execSync calls with variables to use spawn() with array arguments to prevent shell injection.\",\n \"affected_vulnerabilities\": [\"VULN-006\"],\n \"implementation_effort\": \"MEDIUM\",\n \"timeline\": \"URGENT\"\n },\n {\n \"priority\": \"high\",\n \"category\": \"network-security\",\n \"title\": \"Add HTTPS Certificate Validation and Pinning\",\n \"description\": \"Implement certificate pinning or response signature validation for external API calls to OpenRouter.\",\n \"affected_vulnerabilities\": [\"VULN-007\"],\n \"implementation_effort\": \"MEDIUM\",\n \"timeline\": \"HIGH\"\n },\n {\n \"priority\": \"high\",\n \"category\": \"secrets-management\",\n \"title\": \"Never Log API Keys or Secrets\",\n \"description\": \"Remove all logging of API key prefixes. Log only the length: console.log('API Key length:', key.length)\",\n \"affected_vulnerabilities\": [\"VULN-010\"],\n \"implementation_effort\": \"LOW\",\n \"timeline\": \"IMMEDIATE\"\n },\n {\n \"priority\": \"medium\",\n \"category\": \"fingerprinting-defense\",\n \"title\": \"Randomize or Make HTTP Headers Configurable\",\n \"description\": \"Don't hardcode identifiable headers. Use configurable, generic headers that don't identify ruflo.\",\n \"affected_vulnerabilities\": [\"VULN-008\"],\n \"implementation_effort\": \"LOW\",\n \"timeline\": \"HIGH\"\n },\n {\n \"priority\": \"medium\",\n \"category\": \"input-validation\",\n \"title\": \"Validate API Key Format Before Use\",\n \"description\": \"Add format validation to API keys fetched from environment or secrets manager.\",\n \"affected_vulnerabilities\": [\"VULN-011\"],\n \"implementation_effort\": \"LOW\",\n \"timeline\": \"MEDIUM\"\n }\n ],\n \"cwe_top_findings\": [\n {\n \"cwe\": \"CWE-94\",\n \"title\": \"Code Injection\",\n \"count\": 1,\n \"severity\": \"critical\",\n \"description\": \"Command injection via unvalidated npm package execution\"\n },\n {\n \"cwe\": \"CWE-78\",\n \"title\": \"OS Command Injection\",\n \"count\": 1,\n \"severity\": \"high\",\n \"description\": \"Shell command injection in gcloud call\"\n },\n {\n \"cwe\": \"CWE-22\",\n \"title\": \"Path Traversal\",\n \"count\": 2,\n \"severity\": \"high\",\n \"description\": \"Unvalidated file path arguments allow arbitrary file read\"\n },\n {\n \"cwe\": \"CWE-95\",\n \"title\": \"Code Injection in Dynamic Evaluation\",\n \"count\": 1,\n \"severity\": \"critical\",\n \"description\": \"Environment variable injection of npm packages\"\n },\n {\n \"cwe\": \"CWE-295\",\n \"title\": \"Improper Certificate Validation\",\n \"count\": 1,\n \"severity\": \"medium\",\n \"description\": \"No HTTPS certificate pinning for external APIs\"\n }\n ],\n \"remediation_plan\": {\n \"phase_1_critical\": {\n \"duration\": \"1-2 days\",\n \"tasks\": [\n {\n \"task\": \"Fix version pinning (VULN-001, VULN-004, VULN-005)\",\n \"files\": [\"_darwin.mjs\", \"_redblue.mjs\", \"_harness.mjs\", \"test-with-openrouter.mjs\"],\n \"change\": \"Replace ~0.8.0 with 0.8.0, @latest with @0.3.0\"\n },\n {\n \"task\": \"Add path traversal protection (VULN-002, VULN-009)\",\n \"files\": [\"drift-from-history.mjs\", \"evolve.mjs\"],\n \"change\": \"Add path.resolve() and '..' validation\"\n },\n {\n \"task\": \"Whitelist environment variables (VULN-003)\",\n \"files\": [\"oia-audit.mjs\", \"audit-list.mjs\", \"audit-trend.mjs\"],\n \"change\": \"Add validation function for CLI_PKG and CLI_CORE\"\n },\n {\n \"task\": \"Remove secret key logging (VULN-010)\",\n \"files\": [\"test-with-openrouter.mjs\"],\n \"change\": \"Log only length, not prefix\"\n }\n ]\n },\n \"phase_2_high\": {\n \"duration\": \"3-5 days\",\n \"tasks\": [\n {\n \"task\": \"Fix command injection (VULN-006)\",\n \"files\": [\"test-with-openrouter.mjs\"],\n \"change\": \"Replace execSync with spawn()\"\n },\n {\n \"task\": \"Add HTTPS certificate validation (VULN-007)\",\n \"files\": [\"test-with-openrouter.mjs\"],\n \"change\": \"Implement response validation or certificate pinning\"\n },\n {\n \"task\": \"Make headers configurable (VULN-008)\",\n \"files\": [\"test-with-openrouter.mjs\"],\n \"change\": \"Use environment variables for HTTP headers\"\n }\n ]\n },\n \"phase_3_medium\": {\n \"duration\": \"2-3 days\",\n \"tasks\": [\n {\n \"task\": \"Validate API key format (VULN-011)\",\n \"files\": [\"test-with-openrouter.mjs\"],\n \"change\": \"Add format validation before use\"\n },\n {\n \"task\": \"Security testing\",\n \"files\": [\"test-graceful-degradation.mjs\"],\n \"change\": \"Add tests for path traversal and injection vectors\"\n }\n ]\n }\n },\n \"notes\": {\n \"architecture\": \"The plugin is subprocess-based with graceful degradation (ADR-150). No static library imports of @metaharness/* outside optional paths. This constrains but doesn't eliminate security risks.\",\n \"testing_surface\": \"Most vulnerabilities are in scripts/ (32 .mjs files). The test file (test-with-openrouter.mjs) has multiple security issues related to secrets management and command injection.\",\n \"dependencies\": \"All dependencies use tilde ranges or @latest which is a supply chain risk. The plugin is designed to be removable from the core ruflo package if metaharness is unavailable.\",\n \"deployment\": \"This plugin runs as part of CLI commands. Vulnerabilities here can impact any ruflo user who invokes metaharness commands. CRITICAL vulnerabilities should be fixed before production release.\"\n }\n}\n```\n\n## Summary\n\n**Risk Score: 67/100 (MEDIUM-HIGH)**\n\n### Critical Findings:\n1. **Supply Chain Attacks**: Command injection via `npx -y` and `@latest` versioning allow malicious npm packages to be installed\n2. **Path Traversal**: File argument validation missing in 2 files, allowing arbitrary file reads\n3. **Environment Variable Injection**: CLI package name not validated, allowing package hijacking\n\n### Immediate Actions Required:\n- ✅ Replace all `@latest` with exact version pins\n- ✅ Replace `~0.x.x` with `0.x.x` (exact pinning)\n- ✅ Add path.resolve() validation to file arguments\n- ✅ Whitelist environment variable values\n- ✅ Stop logging API key prefixes\n\nThe plugin's subprocess-based architecture is good for isolation, but command-line argument handling needs hardening before production use.\n",
6
+ "parsedOutput": {
7
+ "audit_metadata": {
8
+ "project": "ruflo-metaharness",
9
+ "path": "/Users/cohen/Projects/ruflo/plugins/ruflo-metaharness",
10
+ "scan_date": "2026-07-09",
11
+ "analyzer": "multi-agent-security-audit",
12
+ "codebase_type": "npm plugin - subprocess-based CLI wrapper",
13
+ "total_files_scanned": 32,
14
+ "scripts_analyzed": 32,
15
+ "risk_score": 67,
16
+ "risk_level": "MEDIUM-HIGH"
17
+ },
18
+ "vulnerabilities": [
19
+ {
20
+ "id": "VULN-001",
21
+ "severity": "critical",
22
+ "category": "command-injection",
23
+ "file": "scripts/_darwin.mjs",
24
+ "line": 80,
25
+ "title": "Command Injection via npx -y Without Version Pinning",
26
+ "description": "Uses 'npx -y -p DARWIN_PIN metaharness-darwin' which allows arbitrary npm package execution. If a compromised version (0.8.1, 0.8.2, etc.) is published, all users auto-install malicious code. This is a supply chain attack vector.",
27
+ "code_snippet": "npx -y -p DARWIN_PIN metaharness-darwin ...",
28
+ "attack_vector": "Malicious npm package published as patch update. User runs command → npm installs compromised version → arbitrary code execution",
29
+ "impact": "Remote code execution on developer machines running ruflo commands",
30
+ "recommendation": "Migrate from npx -y to the versioned cache install pattern used in _redblue.mjs and _harness.mjs. Pin exact version in cache directory, validate checksum before execution.",
31
+ "cwe": "CWE-94: Improper Control of Generation of Code ('Code Injection')",
32
+ "cvss_vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
33
+ "cvss_score": 8.8
34
+ },
35
+ {
36
+ "id": "VULN-002",
37
+ "severity": "critical",
38
+ "category": "path-traversal",
39
+ "file": "scripts/drift-from-history.mjs",
40
+ "line": 172,
41
+ "title": "Path Traversal in --baseline-file Argument",
42
+ "description": "The --baseline-file argument is not validated before use. Users can specify '../../../etc/passwd' or other arbitrary file paths to read system files.",
43
+ "code_snippet": "// baseline-file argument passed without validation\nconst baselineFile = options['baseline-file']; // No path.resolve() or validation\n",
44
+ "attack_vector": "Attacker specifies: ruflo metaharness drift-from-history --baseline-file ../../../../etc/passwd",
45
+ "impact": "Arbitrary file read access on the system, exposure of sensitive files",
46
+ "recommendation": "1. Validate file paths with path.resolve()\n2. Reject paths containing '..'\n3. Enforce directory whitelists\n4. Use path.relative() to verify file is within expected directory",
47
+ "cwe": "CWE-22: Improper Limitation of a Pathname to a Restricted Directory",
48
+ "cvss_vector": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N",
49
+ "cvss_score": 5.7
50
+ },
51
+ {
52
+ "id": "VULN-003",
53
+ "severity": "critical",
54
+ "category": "environment-variable-injection",
55
+ "file": "scripts/oia-audit.mjs",
56
+ "line": 36,
57
+ "title": "Environment Variable Injection - CLI_CORE/CLI_PKG Not Validated",
58
+ "description": "Environment variables CLI_CORE and CLI_PKG are constructed directly from process.env without whitelist validation. Attackers can inject different npm packages or memory namespaces by setting these variables.",
59
+ "affected_files": [
60
+ "scripts/oia-audit.mjs:36",
61
+ "scripts/audit-list.mjs:22",
62
+ "scripts/audit-trend.mjs:38"
63
+ ],
64
+ "code_snippet": "const CLI_PKG = process.env.CLI_PKG || '@claude-flow/cli';\n// No validation that CLI_PKG is actually @claude-flow/cli or similar",
65
+ "attack_vector": "export CLI_PKG='malicious-package@latest' && ruflo metaharness oia-audit",
66
+ "impact": "Execution of malicious npm packages in the critical audit pipeline, potential data theft or system compromise",
67
+ "recommendation": "Implement strict whitelist validation:\n1. Only allow: '@claude-flow/cli', '@claude-flow/cli-core'\n2. Use exact version pins, reject @latest\n3. Validate namespace names (alphanumeric + hyphen only)\n4. Log rejected env vars for monitoring",
68
+ "cwe": "CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code",
69
+ "cvss_vector": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
70
+ "cvss_score": 7.8
71
+ },
72
+ {
73
+ "id": "VULN-004",
74
+ "severity": "high",
75
+ "category": "dependency-vulnerability",
76
+ "file": "scripts/_darwin.mjs",
77
+ "line": 50,
78
+ "title": "Tilde-Range Version Pinning Allows Patch Exploitation",
79
+ "description": "Uses ~0.8.0 instead of exact 0.8.0, allowing automatic patch updates. If 0.8.1 is compromised, users auto-update to malicious version.",
80
+ "affected_locations": [
81
+ "scripts/_darwin.mjs:50 (~0.8.0)",
82
+ "scripts/_redblue.mjs:63 (~0.1.4)",
83
+ "scripts/_harness.mjs:59 (~0.3.0)"
84
+ ],
85
+ "code_snippet": "const DARWIN_PIN = '0.8.0';\nconst versionRange = `~${DARWIN_PIN}`; // Expands to >=0.8.0 <0.9.0",
86
+ "impact": "Supply chain attack - compromised patch version bypasses security reviews",
87
+ "recommendation": "Use exact version pinning (e.g., 0.8.0 not ~0.8.0). Create explicit update process with security review before bumping versions.",
88
+ "cwe": "CWE-1104: Use of Unmaintained Third Party Components",
89
+ "cvss_vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
90
+ "cvss_score": 8.8
91
+ },
92
+ {
93
+ "id": "VULN-005",
94
+ "severity": "high",
95
+ "category": "dependency-vulnerability",
96
+ "file": "scripts/test-with-openrouter.mjs",
97
+ "line": 109,
98
+ "title": "@latest Version Pinning in Test - Highest Supply Chain Risk",
99
+ "description": "Uses 'npx -y metaharness@latest' which fetches arbitrary versions without pinning. Every invocation could retrieve malicious code.",
100
+ "code_snippet": "const result = execSync('npx -y metaharness@latest --version');\n",
101
+ "impact": "HIGHEST supply chain attack risk - every test execution could be compromised",
102
+ "recommendation": "Pin to exact version: metaharness@0.3.0, not @latest. Update version only after security review and testing.",
103
+ "cwe": "CWE-1104: Use of Unmaintained Third Party Components",
104
+ "cvss_vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
105
+ "cvss_score": 8.8
106
+ },
107
+ {
108
+ "id": "VULN-006",
109
+ "severity": "high",
110
+ "category": "command-injection",
111
+ "file": "scripts/test-with-openrouter.mjs",
112
+ "line": 65,
113
+ "title": "Command Injection in gcloud Secrets Retrieval",
114
+ "description": "Variable secretName is embedded directly in gcloud command without proper escaping: execSync(`gcloud secrets versions access latest --secret=${secretName}`). If secretName contains shell metacharacters, arbitrary commands execute.",
115
+ "code_snippet": "const secretValue = execSync(`gcloud secrets versions access latest --secret=${secretName}`);\n",
116
+ "attack_vector": "secretName = 'X; rm -rf /; #' → execSync executes rm command",
117
+ "impact": "Arbitrary command execution on the system",
118
+ "recommendation": "1. Use spawn() with array arguments instead of execSync with string interpolation\n2. Or properly escape secretName with shellEscape library\n3. Example: spawn('gcloud', ['secrets', 'versions', 'access', 'latest', '--secret=' + secretName])",
119
+ "cwe": "CWE-78: Improper Neutralization of Special Elements used in an OS Command",
120
+ "cvss_vector": "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H",
121
+ "cvss_score": 7.4
122
+ },
123
+ {
124
+ "id": "VULN-007",
125
+ "severity": "medium",
126
+ "category": "network-security",
127
+ "file": "scripts/test-with-openrouter.mjs",
128
+ "line": 76,
129
+ "title": "No HTTPS Certificate Pinning or Validation",
130
+ "description": "Hardcoded HTTPS endpoint 'https://openrouter.ai/api/v1/models' has no certificate pinning or response validation. Vulnerable to MITM attacks if DNS is compromised.",
131
+ "code_snippet": "const modelsResponse = await fetch('https://openrouter.ai/api/v1/models');\n",
132
+ "impact": "MITM attack redirects to malicious server, API key theft, data interception",
133
+ "recommendation": "1. Add response validation and integrity checks\n2. Consider TLS certificate pinning using node-tls-client or similar\n3. Validate response schema and signatures\n4. Add certificate transparency checks",
134
+ "cwe": "CWE-295: Improper Certificate Validation",
135
+ "cvss_vector": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N",
136
+ "cvss_score": 6.9
137
+ },
138
+ {
139
+ "id": "VULN-008",
140
+ "severity": "medium",
141
+ "category": "information-disclosure",
142
+ "file": "scripts/test-with-openrouter.mjs",
143
+ "line": 92,
144
+ "title": "Hardcoded HTTP Headers Aid Fingerprinting",
145
+ "description": "Fixed User-Agent and Referer headers are hardcoded, enabling targeted attacks and fingerprinting of ruflo users.",
146
+ "code_snippet": "headers: {\n 'User-Agent': 'ruflo-metaharness-integration',\n 'HTTP-Referer': 'https://github.com/ruvnet/ruflo'\n}\n",
147
+ "impact": "Enables identification and targeting of ruflo users, fingerprinting for attacks",
148
+ "recommendation": "1. Make headers configurable via environment variables\n2. Randomize User-Agent\n3. Use generic headers that don't identify the tool",
149
+ "cwe": "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor",
150
+ "cvss_vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N",
151
+ "cvss_score": 5.3
152
+ },
153
+ {
154
+ "id": "VULN-009",
155
+ "severity": "medium",
156
+ "category": "path-traversal",
157
+ "file": "scripts/evolve.mjs",
158
+ "line": 114,
159
+ "title": "Incomplete Path Validation in --repo Argument",
160
+ "description": "The --repo argument is checked for existence but not fully validated for path traversal. Error handling incomplete.",
161
+ "code_snippet": "if (!fs.existsSync(repoPath)) {\n return { error: 'Repository not found' };\n}\n// Missing: path.resolve() normalization, rejection of .., leading slashes",
162
+ "impact": "Potential path traversal if error handling is bypassed",
163
+ "recommendation": "1. Use path.resolve() to normalize paths\n2. Verify normalized path is within expected directory\n3. Reject paths containing '..'\n4. Reject absolute paths or symlinks outside project",
164
+ "cwe": "CWE-22: Improper Limitation of a Pathname to a Restricted Directory",
165
+ "cvss_vector": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L",
166
+ "cvss_score": 4.7
167
+ },
168
+ {
169
+ "id": "VULN-010",
170
+ "severity": "medium",
171
+ "category": "information-disclosure",
172
+ "file": "scripts/test-with-openrouter.mjs",
173
+ "line": 144,
174
+ "title": "API Key Partially Logged to Console",
175
+ "description": "API key is logged with prefix visible: console.log(key.slice(0, 7) + '…'). Even partial keys can be used in replay attacks or help attackers guess full keys.",
176
+ "code_snippet": "console.log('API Key:', apiKey.slice(0, 7) + '…');\n",
177
+ "impact": "API key leaked in logs, bug reports, screenshots, CI logs",
178
+ "recommendation": "Don't log any part of the API key, only its length:\nconsole.log('API Key length:', apiKey.length);",
179
+ "cwe": "CWE-532: Insertion of Sensitive Information into Log File",
180
+ "cvss_vector": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N",
181
+ "cvss_score": 5.7
182
+ },
183
+ {
184
+ "id": "VULN-011",
185
+ "severity": "low",
186
+ "category": "authentication",
187
+ "file": "scripts/test-with-openrouter.mjs",
188
+ "line": 87,
189
+ "title": "API Key Passed via Environment Variable Without Validation",
190
+ "description": "API key from GCP Secret Manager is not validated for format or length before use. Could accept empty or invalid keys silently.",
191
+ "code_snippet": "const apiKey = execSync(`gcloud secrets versions access latest --secret=OPENROUTER_API_KEY`).toString().trim();\nif (!apiKey) throw new Error('...');\n// Missing: format validation, length check, pattern matching",
192
+ "impact": "Invalid credentials could cause unexpected behavior or reveal secrets in error messages",
193
+ "recommendation": "Add validation:\nif (!apiKey || !apiKey.match(/^sk-[a-zA-Z0-9_-]{40,}/)) throw new Error('Invalid key format');",
194
+ "cwe": "CWE-347: Improper Verification of Cryptographic Signature",
195
+ "cvss_vector": "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:L",
196
+ "cvss_score": 3.4
197
+ }
198
+ ],
199
+ "summary": {
200
+ "total_vulnerabilities": 11,
201
+ "critical": 3,
202
+ "high": 3,
203
+ "medium": 4,
204
+ "low": 1,
205
+ "risk_score": 67,
206
+ "risk_level": "MEDIUM-HIGH"
207
+ },
208
+ "vulnerability_distribution": {
209
+ "command_injection": 3,
210
+ "path_traversal": 2,
211
+ "environment_variable_injection": 1,
212
+ "dependency_vulnerabilities": 2,
213
+ "network_security": 1,
214
+ "information_disclosure": 1,
215
+ "authentication": 1
216
+ },
217
+ "affected_files": {
218
+ "scripts/_darwin.mjs": [
219
+ "VULN-001",
220
+ "VULN-004"
221
+ ],
222
+ "scripts/drift-from-history.mjs": [
223
+ "VULN-002"
224
+ ],
225
+ "scripts/oia-audit.mjs": [
226
+ "VULN-003"
227
+ ],
228
+ "scripts/audit-list.mjs": [
229
+ "VULN-003"
230
+ ],
231
+ "scripts/audit-trend.mjs": [
232
+ "VULN-003"
233
+ ],
234
+ "scripts/_redblue.mjs": [
235
+ "VULN-004"
236
+ ],
237
+ "scripts/_harness.mjs": [
238
+ "VULN-004"
239
+ ],
240
+ "scripts/test-with-openrouter.mjs": [
241
+ "VULN-005",
242
+ "VULN-006",
243
+ "VULN-007",
244
+ "VULN-008",
245
+ "VULN-010",
246
+ "VULN-011"
247
+ ],
248
+ "scripts/evolve.mjs": [
249
+ "VULN-009"
250
+ ]
251
+ },
252
+ "recommendations": [
253
+ {
254
+ "priority": "critical",
255
+ "category": "supply-chain-security",
256
+ "title": "Eliminate @latest and Tilde-Range Version Pinning",
257
+ "description": "Migrate from ~0.3.0 and @latest to exact version pins (0.3.0). This prevents automatic installation of compromised patch updates.",
258
+ "affected_vulnerabilities": [
259
+ "VULN-001",
260
+ "VULN-004",
261
+ "VULN-005"
262
+ ],
263
+ "implementation_effort": "LOW",
264
+ "timeline": "IMMEDIATE"
265
+ },
266
+ {
267
+ "priority": "critical",
268
+ "category": "input-validation",
269
+ "title": "Implement Path Traversal Defense Across All File Operations",
270
+ "description": "Add path.resolve() validation and '..' rejection to all file argument handlers (drift-from-history.mjs, evolve.mjs)",
271
+ "affected_vulnerabilities": [
272
+ "VULN-002",
273
+ "VULN-009"
274
+ ],
275
+ "implementation_effort": "LOW",
276
+ "timeline": "IMMEDIATE"
277
+ },
278
+ {
279
+ "priority": "critical",
280
+ "category": "environment-security",
281
+ "title": "Whitelist Environment Variable Values",
282
+ "description": "Validate CLI_PKG and CLI_CORE against whitelist. Only allow official @claude-flow packages with exact versions.",
283
+ "affected_vulnerabilities": [
284
+ "VULN-003"
285
+ ],
286
+ "implementation_effort": "MEDIUM",
287
+ "timeline": "IMMEDIATE"
288
+ },
289
+ {
290
+ "priority": "high",
291
+ "category": "command-injection-prevention",
292
+ "title": "Replace execSync String Interpolation with spawn()",
293
+ "description": "Convert all execSync calls with variables to use spawn() with array arguments to prevent shell injection.",
294
+ "affected_vulnerabilities": [
295
+ "VULN-006"
296
+ ],
297
+ "implementation_effort": "MEDIUM",
298
+ "timeline": "URGENT"
299
+ },
300
+ {
301
+ "priority": "high",
302
+ "category": "network-security",
303
+ "title": "Add HTTPS Certificate Validation and Pinning",
304
+ "description": "Implement certificate pinning or response signature validation for external API calls to OpenRouter.",
305
+ "affected_vulnerabilities": [
306
+ "VULN-007"
307
+ ],
308
+ "implementation_effort": "MEDIUM",
309
+ "timeline": "HIGH"
310
+ },
311
+ {
312
+ "priority": "high",
313
+ "category": "secrets-management",
314
+ "title": "Never Log API Keys or Secrets",
315
+ "description": "Remove all logging of API key prefixes. Log only the length: console.log('API Key length:', key.length)",
316
+ "affected_vulnerabilities": [
317
+ "VULN-010"
318
+ ],
319
+ "implementation_effort": "LOW",
320
+ "timeline": "IMMEDIATE"
321
+ },
322
+ {
323
+ "priority": "medium",
324
+ "category": "fingerprinting-defense",
325
+ "title": "Randomize or Make HTTP Headers Configurable",
326
+ "description": "Don't hardcode identifiable headers. Use configurable, generic headers that don't identify ruflo.",
327
+ "affected_vulnerabilities": [
328
+ "VULN-008"
329
+ ],
330
+ "implementation_effort": "LOW",
331
+ "timeline": "HIGH"
332
+ },
333
+ {
334
+ "priority": "medium",
335
+ "category": "input-validation",
336
+ "title": "Validate API Key Format Before Use",
337
+ "description": "Add format validation to API keys fetched from environment or secrets manager.",
338
+ "affected_vulnerabilities": [
339
+ "VULN-011"
340
+ ],
341
+ "implementation_effort": "LOW",
342
+ "timeline": "MEDIUM"
343
+ }
344
+ ],
345
+ "cwe_top_findings": [
346
+ {
347
+ "cwe": "CWE-94",
348
+ "title": "Code Injection",
349
+ "count": 1,
350
+ "severity": "critical",
351
+ "description": "Command injection via unvalidated npm package execution"
352
+ },
353
+ {
354
+ "cwe": "CWE-78",
355
+ "title": "OS Command Injection",
356
+ "count": 1,
357
+ "severity": "high",
358
+ "description": "Shell command injection in gcloud call"
359
+ },
360
+ {
361
+ "cwe": "CWE-22",
362
+ "title": "Path Traversal",
363
+ "count": 2,
364
+ "severity": "high",
365
+ "description": "Unvalidated file path arguments allow arbitrary file read"
366
+ },
367
+ {
368
+ "cwe": "CWE-95",
369
+ "title": "Code Injection in Dynamic Evaluation",
370
+ "count": 1,
371
+ "severity": "critical",
372
+ "description": "Environment variable injection of npm packages"
373
+ },
374
+ {
375
+ "cwe": "CWE-295",
376
+ "title": "Improper Certificate Validation",
377
+ "count": 1,
378
+ "severity": "medium",
379
+ "description": "No HTTPS certificate pinning for external APIs"
380
+ }
381
+ ],
382
+ "remediation_plan": {
383
+ "phase_1_critical": {
384
+ "duration": "1-2 days",
385
+ "tasks": [
386
+ {
387
+ "task": "Fix version pinning (VULN-001, VULN-004, VULN-005)",
388
+ "files": [
389
+ "_darwin.mjs",
390
+ "_redblue.mjs",
391
+ "_harness.mjs",
392
+ "test-with-openrouter.mjs"
393
+ ],
394
+ "change": "Replace ~0.8.0 with 0.8.0, @latest with @0.3.0"
395
+ },
396
+ {
397
+ "task": "Add path traversal protection (VULN-002, VULN-009)",
398
+ "files": [
399
+ "drift-from-history.mjs",
400
+ "evolve.mjs"
401
+ ],
402
+ "change": "Add path.resolve() and '..' validation"
403
+ },
404
+ {
405
+ "task": "Whitelist environment variables (VULN-003)",
406
+ "files": [
407
+ "oia-audit.mjs",
408
+ "audit-list.mjs",
409
+ "audit-trend.mjs"
410
+ ],
411
+ "change": "Add validation function for CLI_PKG and CLI_CORE"
412
+ },
413
+ {
414
+ "task": "Remove secret key logging (VULN-010)",
415
+ "files": [
416
+ "test-with-openrouter.mjs"
417
+ ],
418
+ "change": "Log only length, not prefix"
419
+ }
420
+ ]
421
+ },
422
+ "phase_2_high": {
423
+ "duration": "3-5 days",
424
+ "tasks": [
425
+ {
426
+ "task": "Fix command injection (VULN-006)",
427
+ "files": [
428
+ "test-with-openrouter.mjs"
429
+ ],
430
+ "change": "Replace execSync with spawn()"
431
+ },
432
+ {
433
+ "task": "Add HTTPS certificate validation (VULN-007)",
434
+ "files": [
435
+ "test-with-openrouter.mjs"
436
+ ],
437
+ "change": "Implement response validation or certificate pinning"
438
+ },
439
+ {
440
+ "task": "Make headers configurable (VULN-008)",
441
+ "files": [
442
+ "test-with-openrouter.mjs"
443
+ ],
444
+ "change": "Use environment variables for HTTP headers"
445
+ }
446
+ ]
447
+ },
448
+ "phase_3_medium": {
449
+ "duration": "2-3 days",
450
+ "tasks": [
451
+ {
452
+ "task": "Validate API key format (VULN-011)",
453
+ "files": [
454
+ "test-with-openrouter.mjs"
455
+ ],
456
+ "change": "Add format validation before use"
457
+ },
458
+ {
459
+ "task": "Security testing",
460
+ "files": [
461
+ "test-graceful-degradation.mjs"
462
+ ],
463
+ "change": "Add tests for path traversal and injection vectors"
464
+ }
465
+ ]
466
+ }
467
+ },
468
+ "notes": {
469
+ "architecture": "The plugin is subprocess-based with graceful degradation (ADR-150). No static library imports of @metaharness/* outside optional paths. This constrains but doesn't eliminate security risks.",
470
+ "testing_surface": "Most vulnerabilities are in scripts/ (32 .mjs files). The test file (test-with-openrouter.mjs) has multiple security issues related to secrets management and command injection.",
471
+ "dependencies": "All dependencies use tilde ranges or @latest which is a supply chain risk. The plugin is designed to be removable from the core ruflo package if metaharness is unavailable.",
472
+ "deployment": "This plugin runs as part of CLI commands. Vulnerabilities here can impact any ruflo user who invokes metaharness commands. CRITICAL vulnerabilities should be fixed before production release."
473
+ }
474
+ },
475
+ "durationMs": 248606,
476
+ "model": "haiku",
477
+ "sandboxMode": "strict",
478
+ "workerType": "audit",
479
+ "timestamp": "2026-07-09T17:44:02.531Z",
480
+ "executionId": "audit_1783618793925_4ee7tf"
481
+ }
@@ -0,0 +1,19 @@
1
+ [2026-07-09T17:54:02.594Z] PROMPT
2
+ ============================================================
3
+ Analyze this codebase for security vulnerabilities:
4
+ - Check for hardcoded secrets (API keys, passwords)
5
+ - Identify SQL injection risks
6
+ - Find XSS vulnerabilities
7
+ - Check for insecure dependencies
8
+ - Identify authentication/authorization issues
9
+
10
+ Provide a JSON report with:
11
+ {
12
+ "vulnerabilities": [{ "severity": "high|medium|low", "file": "...", "line": N, "description": "..." }],
13
+ "riskScore": 0-100,
14
+ "recommendations": ["..."]
15
+ }
16
+
17
+ ## Instructions
18
+
19
+ Analyze the codebase and provide your response following the format specified in the task.