Repository navigation
Closed
Labels
ready-for-agentTriage: ready for an agent to pick upTriage: ready for an agent to pick up
Description
Phase spec from the 2026-07-09 security audit map (#24). Closes audit High #2 (thread/disk exhaustion on sc serve --http) — ADR-0036's three named operational boundaries plus the unbounded-spool gap the research surfaced. Zero new dependencies; PROTOCOL_VERSION stays 3.
Locked decisions
From Decide: HTTP listener resource limits (research: bounded-server patterns, docs/research/bounded-server-patterns.md):
- Connection limit — atomic count; at the limit, accept → immediate busy status at the HTTP opening (the 401/404 seam, before any wire handshake) → close. No queuing. Default 32,
--max-connections <n>, 0 = unlimited. One total cap (no pre-auth sub-cap). - Idle/progress deadline — read+write socket timeouts persist for the whole session (replace the clear at
http_transport.rs:597-599; addset_write_timeoutfor the GetPack send side). Per-syscall timeout is progress-based under P25 chunking; timeout is connection-fatal (TempPackGuardcleans the spool on unwind). HandleWouldBlock(Unix) andTimedOut(Windows). On by default, 300s,--timeout <secs>, 0 = disable; opening keeps its 30s. Recorded divergence from git-daemon's off-default. Timeouts set on theTcpStreambeneath any future TLS wrap (P32 compose point). - Aggregate spool cap — counted mid-stream abort in the pack-stream readers (git
receive.maxInputSizeshape), typed error on the existing reply seam. Default 16 GiB (recorded divergence from git's unlimited),--max-pack-size <bytes>, 0 = unlimited; values <MAX_OBJECT_SIZErejected as invalid config. Composes above ADR-0039's per-frame/per-record/decompression caps. - Read-only drain cap — the drain-for-sync before
EC_READONLY(wire.rs:678) drains at most 8 MiB; larger doomed pushes are dropped mid-send. - Accept-loop backoff — Go's shape verbatim: 5ms doubling to 1s, reset on success; hardcoded, no knob, no reserved-fd trick.
Non-goals
Pre-auth connection sub-caps (sshd MaxStartups-style), reserved-fd shedding, client-side spool caps — all recorded as possible follow-ons, not this phase.
Acceptance criteria
- Each bound has pinned regression tests (limit reached → busy status; stall → connection dropped + spool cleaned; oversized pack → typed error mid-stream + zero residue; accept-error backoff).
- Existing demos stay green; extend or add a demo proving limit + timeout + spool-cap behavior with zero
.sc/tmpresidue. - ADR recording all four bounds, the two divergences-from-prior-art (timeout on-by-default, finite spool default), and the drain-cap posture.
docs/THREAT-MODEL.md: mark the three ADR-0036 boundaries closed, name and close the unbounded-spool gap, and carry the two audit-boundary re-affirmation wordings from env-var secret exposure (same-user adversary defeats the identity key; fd/stdin stays an additive deferred mode) and signature replay (ancestry is already id-bound; the residue is ref binding only — "replayable to a ref tip within its own history").- CLAUDE.md command docs updated for the three new flags.
Part of the #24 audit-response map.
Metadata
Metadata
Assignees
Labels
ready-for-agentTriage: ready for an agent to pick upTriage: ready for an agent to pick up
Activity
tonibergholm commentedon Jul 10, 2026
Shipped: PR #41 merged (all four bounds, ADR-0041, THREAT-MODEL closures + the #31/#32 re-affirmation wordings, demo/run_limits_demo.sh). Audit High #2 closed. Deferred follow-ons recorded in ADR-0041: 503-shed RST-race drain-before-close, demo pick_port TOCTOU sweep.