Skip to content

fix(fleet-dispatch): refuse invalid or truncated response framing (#8433) - #8434

Merged
dezren39 merged 1 commit into
mainfrom
queue/14827-8433-strict-framing
Nov 11, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/14827-8433-strict-framing

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Closes #8433.

Problem

read_response in pkgs/fleet/crates/fleet-dispatch/src/lib.rs accepted invalid or truncated HTTP response framing: a malformed Content-Length was silently treated as absent (value.parse().ok()), duplicate lengths overwrote each other, Transfer-Encoding was accepted on a contains("chunked") test, EOF ended the body loop for every framing shape (so a body cut short of its declared length — or cut inside a chunked stream — was returned as if complete; a partial body can be valid JSON, making the truncation silent), and dechunk tolerated chunks missing their CRLF terminator. This conflicts with #6582's present-but-invalid refusal contract.

Change

Strict framing, validated where it is read:

  • Headers: every Content-Length statement (repeated headers, comma-joined values) must parse and all must agree — malformed or conflicting values are transport errors. Content-Length together with any Transfer-Encoding is refused as conflicting framing. Transfer-Encoding is accepted only as the single coding chunked; anything else (including gzip, chunked) is refused as unsupported.
  • Body: the reader now tracks an explicit Framing (length / chunked / close-delimited). EOF before a declared length is met, or anywhere inside a chunked stream (including its trailer section), is a truncation transport error naming the framing and the byte counts. Unframed bodies still run to connection close.
  • Chunks: one strict decoder (parse_chunked) distinguishes complete / incomplete / malformed: non-hex size lines and chunks missing their CRLF terminator are errors, never silent stops. The fleet(dispatch): dechunked_len does unchecked arithmetic on the peer-declared chunk size — overflow panics in debug, wraps in release #6512 checked-arithmetic discipline is preserved (peer-declared sizes are checked before any slicing or allocation; the 64 MiB body bound still applies and the decoded body never exceeds the wire bytes). dechunk/dechunked_len are now wrappers over the strict parser.

Verification

Queue task 14827 (repo-health-code-pilot, lane code-h) — triaged inline and fixed in the same claim.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 02:22
@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e77a1c2-eb8b-49b0-a409-b3c706e945fb
Commits

Reviewing files that changed from the base of the PR and between bfa1385 and 9166fae.

Files selected for processing: 1

  • pkgs/fleet/crates/fleet-dispatch/src/lib.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T02:24:14.330229Z 9166fae PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 63ee781 into main Nov 11, 2026
1 of 9 checks passed
@dezren39
dezren39 deleted the queue/14827-8433-strict-framing branch November 11, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fleet-dispatch accepts invalid or truncated HTTP response framing

1 participant