You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Decide: HTTP listener resource limits (audit High #2) #28
Authenticated (or open-server) clients can hold one OS thread each indefinitely and exhaust disk via unbounded pack spooling; read-only clients reach the spool-before-reject path too (audit High #2). Which protections ship, with what defaults and what operator knobs: connection pool/limit, idle/progress deadlines, max transfer/spool size, accept-loop backoff? Resolution shapes a phase spec.
All four bounds ship in one phase spec (none touches the wire protocol; PROTOCOL_VERSION stays 3). This closes ADR-0036's three named boundaries plus the fourth the research surfaced — the unbounded aggregate pack spool, reachable by read-only clients — updating ADR-0036/0040 and docs/THREAT-MODEL.md accordingly.
Decisions:
Connection limit — atomic count + busy-status-and-close. At the limit the server accepts, immediately writes a busy status at the HTTP opening (the seam where 401/404 already live, before any wire handshake), and closes; the client renders a clear retryable error. No queuing — for long-lived wire sessions, fail-fast beats invisible waits (rejected: block-at-accept semaphore, git-daemon's grace-then-shed). Default 32 (git-daemon's shipped default; sc ws run agents pushing in parallel are legitimate concurrency), --max-connections <n>, 0 = unlimited. One total cap; an sshd MaxStartups-style pre-auth sub-cap is deliberately deferred until real churn proves the need.
Idle/progress deadline — on by default, 300s. Read+write timeouts persist for the whole session (replacing today's clear at http_transport.rs:597-599; a write timeout also covers a client that stops reading mid-GetPack). Under P25 chunking a per-syscall timeout IS progress-based — only true zero-byte stalls trip it — and timeout is connection-fatal (frame desync precludes recovery; TempPackGuard cleans the spool on unwind). --timeout <secs>, 0 = disable; opening keeps its existing 30s. Shipping on-by-default is a recorded divergence from git-daemon's off-default: defaults-off knobs don't close audit Highs, and without a reaper the connection cap is hostage to any single stalled client. 300s (not 60s) because the one legitimate casualty is a client computing between verbs. Compose point with Decide: transport confidentiality for sc+http (audit High #1) #26: timeouts are set on the TcpStream beneath the future rustls wrap.
Aggregate spool cap — 16 GiB default. Counted mid-stream abort in the pack-stream readers (git receive.maxInputSize shape), surfacing as a typed error on the existing reply seam. Finite default is a recorded divergence from git's unlimited: sc servers often share the working tree's volume, and this effort's posture is fail-closed defaults throughout. --max-pack-size <bytes> serve flag (no .sc/config surface exists yet), 0 = unlimited; configured values below MAX_OBJECT_SIZE (256 MiB) are rejected as invalid config. Composes above, never replaces, ADR-0039's per-frame/per-record/decompression caps.
Read-only drain — capped at 8 MiB. The deliberate drain-for-sync before EC_READONLY (wire.rs:678) now drains at most ~8 MiB: an honest ro-token pusher still gets the clean typed error for any small push; anything larger is dropped mid-send and spools nothing more.
Accept backoff — Go's exact shape, hardcoded. 5ms doubling to 1s, reset on success, around the accept loop; no knob (Go ships it knobless), no reserved-fd shed (the connection cap demotes fd exhaustion to external pressure; the refinement can ride a later hardening pass if ever needed).
Activity
docs(research): bounded-server patterns for sc serve --http (#27) (#36)
tonibergholm commentedon Jul 10, 2026
Resolution
All four bounds ship in one phase spec (none touches the wire protocol;
PROTOCOL_VERSIONstays 3). This closes ADR-0036's three named boundaries plus the fourth the research surfaced — the unbounded aggregate pack spool, reachable by read-only clients — updating ADR-0036/0040 anddocs/THREAT-MODEL.mdaccordingly.Decisions:
sc ws runagents pushing in parallel are legitimate concurrency),--max-connections <n>, 0 = unlimited. One total cap; an sshd MaxStartups-style pre-auth sub-cap is deliberately deferred until real churn proves the need.http_transport.rs:597-599; a write timeout also covers a client that stops reading mid-GetPack). Under P25 chunking a per-syscall timeout IS progress-based — only true zero-byte stalls trip it — and timeout is connection-fatal (frame desync precludes recovery;TempPackGuardcleans the spool on unwind).--timeout <secs>, 0 = disable; opening keeps its existing 30s. Shipping on-by-default is a recorded divergence from git-daemon's off-default: defaults-off knobs don't close audit Highs, and without a reaper the connection cap is hostage to any single stalled client. 300s (not 60s) because the one legitimate casualty is a client computing between verbs. Compose point with Decide: transport confidentiality for sc+http (audit High #1) #26: timeouts are set on theTcpStreambeneath the future rustls wrap.receive.maxInputSizeshape), surfacing as a typed error on the existing reply seam. Finite default is a recorded divergence from git's unlimited: sc servers often share the working tree's volume, and this effort's posture is fail-closed defaults throughout.--max-pack-size <bytes>serve flag (no.sc/configsurface exists yet), 0 = unlimited; configured values belowMAX_OBJECT_SIZE(256 MiB) are rejected as invalid config. Composes above, never replaces, ADR-0039's per-frame/per-record/decompression caps.EC_READONLY(wire.rs:678) now drains at most ~8 MiB: an honest ro-token pusher still gets the clean typed error for any small push; anything larger is dropped mid-send and spools nothing more.Research basis: Research: std-only bounded-server patterns for the HTTP listener →
docs/research/bounded-server-patterns.md(PR #36).