v3/implementation/adrs/ADR-066-v3524-audit-remediation.md
----|-------|----------|----------| | CLI Auditor | Commands, stubs, dead code, types, imports | ~3 min | 3 low issues | | MCP Auditor | 260 tools, services, hooks, memory, plugins | ~2 min | 4 stub tools | | Runtime Validator | Build, smoke tests, MCP server, test suite | ~3 min | 3 runtime issues | | Security Auditor | Input validation, secrets, resources, deps | ~2 min | 15 total findings |
| # | Issue | File | Fix Applied |
|---|---|---|---|
| C-1 | Command injection via execSync with string concatenation | browser-tools.ts:25 | Replaced execSync(\agent-browser ${...}`)withexecFileSync('agent-browser', fullArgs)` — array args prevent shell interpretation |
| C-2 | Path traversal in GCS filename | gcs.ts:119 | Added regex validation ^[a-zA-Z0-9._\-]+$ and .. rejection before constructing objectPath |
| C-3 | Prototype pollution via setNestedValue() | config-tools.ts:100-111 | Added DANGEROUS_KEYS check for each key segment (__proto__, constructor, prototype) and max depth limit of 10 |
| # | Issue | File | Fix Applied |
|---|---|---|---|
| H-1 | validateMemoryInput() not called in retrieve/delete handlers | memory-tools.ts | Added validateMemoryInput(key) calls to memory_retrieve and memory_delete handlers |
| H-2 | Unvalidated temp file deletion in GCS | gcs.ts:158,176,205,211 | Added path.resolve() prefix validation before all 4 unlinkSync() calls — ensures file is within temp dir |
| H-3 | Config key nesting unlimited | config-tools.ts:100 | Added MAX_NESTING_DEPTH = 10 guard in setNestedValue() |
| # | Issue | File | Fix Applied |
|---|---|---|---|
| M-1 | Config dir created world-readable | config-tools.ts:47 | Added mode: 0o700 to mkdirSync() |
| M-2 | Swarm tools returning mock data | swarm-tools.ts | Complete rewrite: 4 tools now use file-based state persistence at .claude-flow/swarm/swarm-state.json with real CRUD operations |
| M-3 | Missing commands in lazy-loader | commands/index.ts | Added appliance-advanced and transfer-store to commandLoaders map |
| M-4 | Memory list hangs without daemon | Runtime | (Documented — requires daemon lifecycle change) |
| M-5 | AgentDB controller warning noise | Runtime | (Documented — cosmetic, non-blocking) |
The 4 swarm MCP tools were completely rewritten from stubs to real implementations:
State file: .claude-flow/swarm/swarm-state.json (restrictive 0o700 permissions)
All critical and high-severity security issues are remediated. Medium issues are either fixed or documented for future sprints. The codebase is now at 260/260 real MCP tool implementations (zero stubs).