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
fleet-dispatch accepts invalid or truncated HTTP response framing #8433
Read-only Phase 4 inventory for #6583, main 9b82fb905929042aa5244835bc0e4a5d370d1daf: pkgs/fleet/crates/fleet-dispatch/src/lib.rs:246-259 silently treats malformed Content-Length as absent, overwrites duplicates and accepts Transfer-Encoding containing chunked; :273-292 treats EOF as success even when a declared length or chunked stream is incomplete and returns a partial body. dechunk at :327-346 also tolerates missing chunk terminators. A partial body can be valid JSON, making the truncation silent. This conflicts with #6582’s present-but-invalid refusal contract.
Acceptance
Define and enforce unambiguous framing and reject malformed/conflicting Content-Length and incomplete declared/chunked bodies with the transport error shape.
Add loopback regression tests including invalid and duplicate lengths, truncation after valid JSON bytes, malformed/truncated chunks and valid controls; test oracle is the framing contract.
Respect the response body bound and check all arithmetic before allocation.
Related #6583, #6582; no code was modified in the inventory.
agent-note:v1
task_id: 14827
worker: repo-worker-code
lane: code-h
state: triaged
KIND: triage (inline, task 14827) — small_fix, priority/normal, effort/s, kind/bug; fix proceeding in this same claim
Triage decision:
Work kind: task/small-fix — a bounded correctness fix in one crate (pkgs/fleet/crates/fleet-dispatch), with loopback regression tests; the issue's acceptance names the test oracle (the framing contract).
Priority: priority/normal — fleet-internal transport integrity (silent truncation can pass off a partial body as a complete response), but no live outage; band-10 is reserved for fleet-stalling breakage per the priorities brief.
Effort: effort/s — one function cluster (read_response + chunk helpers in src/lib.rs) plus tests.
Fresh verification of the evidence (current main, 2026-11-11): pkgs/fleet/crates/fleet-dispatch/src/lib.rs still shows every cited defect — Content-Length parsed with value.parse().ok() (malformed silently treated as absent, duplicates overwrite), Transfer-Encoding accepted on a contains("chunked") test, the body loop breaks on EOF and then truncates to whatever arrived (body[..n.min(body.len())] / lenient dechunk), and dechunk tolerates a missing chunk terminator. This conflicts with #6582's present-but-invalid refusal contract, as the issue states.
First concrete step (underway in this claim): strict framing in read_response — refuse malformed/conflicting Content-Length, refuse Content-Length + Transfer-Encoding together and non-final/unsupported transfer codings, treat EOF before a declared length or before a complete chunked stream as a transport error, and make chunk decoding verify terminators — with loopback regression tests for each case plus valid controls.
Acceptance check for the fix: the issue's three bullets — unambiguous framing enforced with the transport error shape; loopback tests covering invalid and duplicate lengths, truncation after valid JSON bytes, malformed/truncated chunks, and valid controls; body bound respected and all arithmetic checked before allocation (the #6512 discipline already present in dechunked_len is preserved).
agent-note:v1
task_id: 14827
worker: repo-worker-code
lane: code-h
state: done
KIND: small_fix — strict response framing landed via PR #8434 (merge 63ee781); this issue is closed
What changed in pkgs/fleet/crates/fleet-dispatch/src/lib.rs (+252/−61):
Content-Length: every statement (repeated headers, comma-joined values) must parse and all must agree; malformed or conflicting values are transport errors instead of silently absent/overwritten.
Transfer-Encoding: accepted only as the single coding chunked; Content-Length + Transfer-Encoding together are refused as conflicting framing; any other coding (including gzip, chunked) is refused as unsupported.
Body reads track an explicit framing: EOF before a declared length, or anywhere inside a chunked stream including its trailer section, is now a truncation transport error — a partial body is never returned as complete. Unframed bodies still run to connection close.
Verification: cargo test -p fleet-dispatch — 16 passed, 0 failed, including 5 new loopback regression tests (valid round-trips for length/chunked-with-trailer/agreeing-duplicate/unframed bodies; refusal of malformed/conflicting/CL+TE framings; truncation after valid JSON bytes; malformed chunk size; missing CRLF terminator). cargo fmt applied. Test oracle is the framing contract, per the issue's acceptance.
Activity
developing-today commentedon Nov 11, 2026
CODE-2511
dezren39 commentedon Nov 11, 2026
agent-note:v1
task_id: 14827
worker: repo-worker-code
lane: code-h
state: triaged
KIND: triage (inline, task 14827) — small_fix, priority/normal, effort/s, kind/bug; fix proceeding in this same claim
Triage decision:
pkgs/fleet/crates/fleet-dispatch), with loopback regression tests; the issue's acceptance names the test oracle (the framing contract).read_response+ chunk helpers insrc/lib.rs) plus tests.Fresh verification of the evidence (current main, 2026-11-11):
pkgs/fleet/crates/fleet-dispatch/src/lib.rsstill shows every cited defect — Content-Length parsed withvalue.parse().ok()(malformed silently treated as absent, duplicates overwrite), Transfer-Encoding accepted on acontains("chunked")test, the body loop breaks on EOF and then truncates to whatever arrived (body[..n.min(body.len())]/ lenientdechunk), anddechunktolerates a missing chunk terminator. This conflicts with #6582's present-but-invalid refusal contract, as the issue states.First concrete step (underway in this claim): strict framing in
read_response— refuse malformed/conflicting Content-Length, refuse Content-Length + Transfer-Encoding together and non-final/unsupported transfer codings, treat EOF before a declared length or before a complete chunked stream as a transport error, and make chunk decoding verify terminators — with loopback regression tests for each case plus valid controls.Acceptance check for the fix: the issue's three bullets — unambiguous framing enforced with the transport error shape; loopback tests covering invalid and duplicate lengths, truncation after valid JSON bytes, malformed/truncated chunks, and valid controls; body bound respected and all arithmetic checked before allocation (the #6512 discipline already present in
dechunked_lenis preserved).Merge pull request #8434 from developing-today/queue/14827-8433-stric…
dezren39 commentedon Nov 11, 2026
agent-note:v1
task_id: 14827
worker: repo-worker-code
lane: code-h
state: done
KIND: small_fix — strict response framing landed via PR #8434 (merge 63ee781); this issue is closed
What changed in
pkgs/fleet/crates/fleet-dispatch/src/lib.rs(+252/−61):chunked; Content-Length + Transfer-Encoding together are refused as conflicting framing; any other coding (includinggzip, chunked) is refused as unsupported.Verification:
cargo test -p fleet-dispatch— 16 passed, 0 failed, including 5 new loopback regression tests (valid round-trips for length/chunked-with-trailer/agreeing-duplicate/unframed bodies; refusal of malformed/conflicting/CL+TE framings; truncation after valid JSON bytes; malformed chunk size; missing CRLF terminator).cargo fmtapplied. Test oracle is the framing contract, per the issue's acceptance.