Description
Summary
Full-codebase cora scan (2026-10-06, pre-0.6.0-tag gate) flagged this MAJOR (scan finding #17): the tole serve --transport mcp accept loop in crates/tole-cli/src/mcp_http.rs unconditionally spawns a tokio task per accepted TCP connection with no cap on concurrent connections and no read/idle/header timeouts. An unauthenticated attacker can open many sockets and trickle bytes to pin tasks and file descriptors indefinitely (slowloris-style DoS).
Reference
The sibling REST transport (serve.rs) hardens against exactly this class (Wave 2, #136): MAX_CONNECTIONS = 32 and SERVE_IO_TIMEOUT = 30s. The MCP transport predates the parity fix.
Proposed fix
Mirror the REST transport's controls in mcp_http.rs:
- connection cap via a tokio
Semaphore(permit per connection, acquired before spawn; refused when exhausted), and - header/read timeouts — hyper 1.x
http1::Builder::header_read_timeout, plus wrapping the body-collection phase intokio::time::timeoutaligned withSERVE_IO_TIMEOUT.
Same class as #136, different face. Should ride the 0.6.0 train before the tag (scan MAJORs are tag blockers per the release gate).
Activity
fix(hardening): mcp-http accept loop — connection cap + IO timeouts (…
ajianaz commentedon Oct 5, 2026
Fixed by #191 (merged to develop as 3c254d5): 32-connection semaphore cap, hyper http1 header_read_timeout (30s), and 30s bounds on the auth-header/request-body read phases — the scan's suggested remedy, full CI green, 351/0 local tests.
chore(release): v0.6.0 (#192)
chore(release): v0.6.0 (#194)
chore(release): v0.7.0 (#225)