|
| 1 | +# Security Roadmap |
| 2 | + |
| 3 | +Last updated: 2026-02-08 |
| 4 | + |
| 5 | +This roadmap is the shortest path from "secure architecture" to "defensible production security posture" for exoclaw. |
| 6 | + |
| 7 | +## Current Baseline |
| 8 | + |
| 9 | +- Strong foundations already in place: |
| 10 | +- WASM plugin isolation and capability scoping (`src/sandbox/mod.rs`). |
| 11 | +- Loopback default bind and token requirement on non-loopback (`src/gateway/server.rs`). |
| 12 | +- Constant-time token comparison (`src/gateway/auth.rs`). |
| 13 | +- Secure credential file permissions (`src/secrets.rs`, `src/fs_util.rs`). |
| 14 | +- CI test/security jobs for Rust tests, wasm UI tests, E2E, and dependency checks (`.github/workflows/test-suite.yml`). |
| 15 | + |
| 16 | +- Known gaps before production claim: |
| 17 | +- TLS termination not implemented in gateway. |
| 18 | +- OpenTelemetry and security observability still pending. |
| 19 | +- No formal rate limiting/abuse throttling layer. |
| 20 | +- No plugin signature verification or trusted plugin provenance policy. |
| 21 | +- No explicit RBAC scope model for RPC methods. |
| 22 | + |
| 23 | +## Target Posture |
| 24 | + |
| 25 | +- P0: Safe private beta on trusted networks. |
| 26 | +- P1: Internet-exposed beta with strong guardrails. |
| 27 | +- P2: Production-grade posture for enterprise-style review. |
| 28 | + |
| 29 | +## P0 Controls (Ship First) |
| 30 | + |
| 31 | +- Transport and exposure: |
| 32 | +- Require TLS termination at ingress for any non-loopback deployment. |
| 33 | +- Require token auth for all non-loopback binds with startup hard-fail. |
| 34 | +- Add WebSocket origin allowlist for browser clients. |
| 35 | + |
| 36 | +- Auth hardening: |
| 37 | +- Support token rotation with active+next token validation window. |
| 38 | +- Add max token length and strict JSON shape checks on connect. |
| 39 | +- Add auth failure cooldown per source IP/session key. |
| 40 | + |
| 41 | +- Abuse prevention: |
| 42 | +- Add request body/message size limits. |
| 43 | +- Add per-IP and per-session rate limits for `chat.send`. |
| 44 | +- Add connection and in-flight stream caps to prevent memory exhaustion. |
| 45 | + |
| 46 | +- Security logging: |
| 47 | +- Emit structured security audit events for auth pass/fail, plugin denied capability, rate-limit hits, and stream timeout. |
| 48 | +- Include request id, session key, remote address, and method name in every audit event. |
| 49 | +- Add panic hook + fatal event breadcrumb in logs. |
| 50 | + |
| 51 | +- CI security gates: |
| 52 | +- Keep existing `cargo audit` and `cargo deny`. |
| 53 | +- Add secret scanning gate (for example `gitleaks`) on pull requests. |
| 54 | +- Add fuzz/safety tests for JSON-RPC parsing and SSE stream parser edge cases. |
| 55 | + |
| 56 | +- Definition of done for P0: |
| 57 | +- All non-loopback deployments run behind TLS ingress with auth token. |
| 58 | +- PRs fail on secrets, dependency CVEs, and security test regressions. |
| 59 | +- Malformed/oversized websocket payloads are rejected safely and tested. |
| 60 | + |
| 61 | +## P1 Controls (Internet Beta) |
| 62 | + |
| 63 | +- Plugin trust and supply chain: |
| 64 | +- Enforce plugin signing (signature + digest) before load. |
| 65 | +- Maintain allowlist of trusted plugin publishers. |
| 66 | +- Persist plugin provenance metadata and verify at startup. |
| 67 | + |
| 68 | +- Authorization model: |
| 69 | +- Introduce method-level scopes (for example `chat:send`, `plugin:list`, `admin:*`). |
| 70 | +- Require explicit scope binding per token. |
| 71 | +- Add deny-by-default policy for admin/control methods. |
| 72 | + |
| 73 | +- Data and secret hardening: |
| 74 | +- Encrypt persisted session/history store at rest once DB persistence lands. |
| 75 | +- Move API key handling to OS keyring option for local mode. |
| 76 | +- Add key rotation command with audit trail. |
| 77 | + |
| 78 | +- Runtime hardening: |
| 79 | +- Add bounded queues and backpressure instrumentation for hot paths. |
| 80 | +- Add circuit breakers around provider calls and webhook adapters. |
| 81 | +- Add host egress allowlist mode for outbound HTTP. |
| 82 | + |
| 83 | +- CI/CD hardening: |
| 84 | +- Generate SBOM on every release artifact. |
| 85 | +- Add release signing and provenance attestation. |
| 86 | +- Block merge without passing security checks and at least one human review. |
| 87 | + |
| 88 | +- Definition of done for P1: |
| 89 | +- Only signed plugins can load in default mode. |
| 90 | +- Tokens are scoped and least-privilege by default. |
| 91 | +- Release artifacts are reproducible, signed, and accompanied by SBOM. |
| 92 | + |
| 93 | +## P2 Controls (Production / Enterprise) |
| 94 | + |
| 95 | +- Advanced controls: |
| 96 | +- Optional mTLS for service-to-service traffic in distributed deployments. |
| 97 | +- WAF/edge policy templates for exposed gateway endpoints. |
| 98 | +- Region-aware key management and secret escrow policy. |
| 99 | + |
| 100 | +- Detection and response: |
| 101 | +- OpenTelemetry traces + metrics + logs with SIEM export path. |
| 102 | +- Alerting playbooks for auth abuse, token anomalies, plugin denial spikes, and provider failure storms. |
| 103 | +- Incident response runbook and recovery drill cadence. |
| 104 | + |
| 105 | +- Resilience and compliance: |
| 106 | +- Backup/restore procedures for persistent state. |
| 107 | +- Data retention and deletion policy with automated enforcement. |
| 108 | +- Security chaos testing and regular threat-model refresh. |
| 109 | + |
| 110 | +- Definition of done for P2: |
| 111 | +- Incident MTTR and detection SLIs are tracked and stable. |
| 112 | +- Security controls are continuously tested in CI and in staging drills. |
| 113 | +- External review can trace controls from policy to code to evidence. |
| 114 | + |
| 115 | +## Coverage and Quality Targets |
| 116 | + |
| 117 | +- Line coverage: |
| 118 | +- Keep minimum backend coverage gate at 70% now. |
| 119 | +- Raise to 80% after P1 controls land. |
| 120 | +- Raise to 85% for security-critical modules (`gateway/auth`, `gateway/protocol`, `sandbox`, `agent/providers`). |
| 121 | + |
| 122 | +- Must-have security test classes: |
| 123 | +- Auth bypass and malformed handshake cases. |
| 124 | +- JSON-RPC parser robustness and type confusion cases. |
| 125 | +- SSE framing/parser fuzz tests (CRLF/LF/CR variants, truncation, long frames). |
| 126 | +- Plugin capability denial and sandbox escape regression tests. |
| 127 | +- Rate-limit and queue-exhaustion behavior tests. |
| 128 | + |
| 129 | +## CI/CD Enforcement Policy |
| 130 | + |
| 131 | +- Required PR checks: |
| 132 | +- `Rust + Coverage` |
| 133 | +- `Dependency Security` |
| 134 | +- `WASM UI Tests` |
| 135 | +- `Playwright E2E` |
| 136 | +- `Secrets Scan` |
| 137 | +- `Security Regression Tests` |
| 138 | + |
| 139 | +- Branch protection: |
| 140 | +- No direct push to `main`. |
| 141 | +- No bypass merge except repository admin emergency policy. |
| 142 | +- Require at least one code review approval. |
| 143 | + |
| 144 | +## Module-by-Module Implementation Plan |
| 145 | + |
| 146 | +- `src/gateway/server.rs`: |
| 147 | +- Add websocket origin checks, body size guards, connection caps, and rate-limit middleware. |
| 148 | +- Add structured remote peer extraction and audit event emission. |
| 149 | + |
| 150 | +- `src/gateway/auth.rs`: |
| 151 | +- Add rotating token set support and strict handshake schema validation. |
| 152 | +- Add explicit auth error codes for observability and client UX. |
| 153 | + |
| 154 | +- `src/gateway/protocol.rs`: |
| 155 | +- Add method scope checks and deny-by-default for privileged methods. |
| 156 | +- Add central request validation and max payload constraints. |
| 157 | + |
| 158 | +- `src/sandbox/mod.rs`: |
| 159 | +- Add plugin signature verification and trusted publisher policy checks. |
| 160 | +- Log capability denials with stable event codes. |
| 161 | + |
| 162 | +- `src/agent/providers.rs`: |
| 163 | +- Add circuit breaker state and retry budget boundaries. |
| 164 | +- Emit security/abuse telemetry around timeout and failure patterns. |
| 165 | + |
| 166 | +- `.github/workflows/test-suite.yml`: |
| 167 | +- Add `secrets-scan` and `security-regressions` jobs as required checks. |
| 168 | +- Publish security test artifacts for failed runs. |
| 169 | + |
| 170 | +## 30/60/90 Day Execution |
| 171 | + |
| 172 | +- By 2026-03-10: |
| 173 | +- Complete all P0 controls and required tests. |
| 174 | +- Enforce branch protection with full required checks. |
| 175 | + |
| 176 | +- By 2026-04-09: |
| 177 | +- Complete P1 plugin signing, method scopes, and release provenance. |
| 178 | +- Raise coverage target to 80%. |
| 179 | + |
| 180 | +- By 2026-05-09: |
| 181 | +- Complete P2 telemetry + incident response + resilience drills. |
| 182 | +- Publish a security posture report mapped to this roadmap. |
0 commit comments