Skip to content

fix(fleet-queue): broker transports — auth before body, reject oversized/incomplete, timeouts (#6515) - #8085

Merged
dezren39 merged 1 commit into
mainfrom
queue/11464-6515-broker-transport-hardening
Nov 10, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/11464-6515-broker-transport-hardening

Conversation

@dezren39

@dezren39 dezren39 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Fixes #6515 — follow-up to PR #6514: dispositions all 11 CodeRabbit review threads on the fleet brokers' dual-bind transports.

What changed

  • Auth before body (thread 4492609604): new pre_body_refusal gate in both brokers, applied on TCP (tiny_http loop) and UDS (uds_http::serve_with_precheck) — an unauthorized or oversized request is refused from its headers alone (401 / 413) before a single body byte is read. Body reads are capped at 16 MiB (cap+1 detects undeclared overruns).
  • UDS read/write timeouts + connection bound (4492609760): 30s per-connection timeouts and a 128-connection cap in uds_http::serve.
  • Oversized bodies rejected, not clamped (4492609738): declared Content-Length > 16 MiB is refused at head parse.
  • Incomplete bodies rejected (4492609747): EOF before the declared length no longer dispatches a truncated request.
  • Chunked Transfer-Encoding rejected (4492609728): not decoded on this transport; broker clients always send Content-Length, so encoded bodies are refused before the handler instead of being misparsed as length-less.
  • Complete-header limit (4492609689): the 64 KiB head cap now applies to the terminator position, not just buffered length.
  • Bind hardening: stale-socket reclamation is serialized with a flock'd .bind-lock file (4492609657); the live-owner probe is bounded to 2s and a timeout reads as "live" (4492609644); non-socket files at the socket path are preserved and the bind refused (4492609635); parent-dir chmod only for directories this call created (4492609622); socket chmod failure now fails the bind instead of being ignored (4492609673).

Documented decision — TCP read timeout

tiny_http 0.12 exposes no per-connection read timeout, so the TCP loops cannot set one. Residual slow-body risk on TCP is bounded by the auth-first gate, the 16 MiB cap, and thread-per-connection isolation; the UDS transport carries real 30s timeouts. Recorded on #6515 per its acceptance criteria.

Tests (oracle-named)

  • cargo test -p fleet-queue --features queue-broker,secrets-broker,client — 129 lib tests + 2 bin-args tests pass.
  • New: pre_body_refusal_decides_from_headers_alone (both brokers), precheck_refuses_before_the_body_is_consumed (a 401 arrives although the declared body is never sent), oversized_content_length_is_rejected_before_the_handler, incomplete_body_is_rejected_before_the_handler, chunked_transfer_encoding_is_rejected_before_the_handler, non_socket_file_is_preserved_and_bind_refused. All rejected-shape oracles: no response / refusal, handler invoked zero times.
  • git diff --check clean. Touched files rustfmt-formatted.

Queue: task 11464 (repo-health-code-pilot), lane code-v.


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 10, 2026 00:46
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-10T00:46:25.665302Z
We couldn’t complete this review. Comment @codex review to try again.
6f17898 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.

@coderabbitai

coderabbitai Bot commented Nov 10, 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 13 seconds.

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: 28d49e67-eba7-4a59-b891-4320593ba362
Commits

Reviewing files that changed from the base of the PR and between 5ba8835 and 6f17898.

Files ignored due to path filters: 1

  • pkgs/fleet/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 4

  • pkgs/fleet/crates/fleet-queue/Cargo.toml
  • pkgs/fleet/crates/fleet-queue/src/queue_broker.rs
  • pkgs/fleet/crates/fleet-queue/src/secrets_broker.rs
  • pkgs/fleet/crates/fleet-queue/src/uds_http.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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@dezren39

Copy link
Copy Markdown
Member Author

Codex review note (task 11464, lane code-v): the Codex code review on this PR failed to run — the summary comment (6755602426) states "We couldn't complete this review" and a follow-up Codex comment confirms the account's Codex usage limits for code reviews are reached. The review produced no findings (no inline Codex comments exist on this PR), so there is nothing undispositioned under the Codex-findings gate; the has_any_findings flag in the review-state marker accompanies the failed run, not a finding list. Verification for this PR stands on the targeted suite: cargo test -p fleet-queue --features queue-broker,secrets-broker,client — 129 lib + 2 bin-args tests pass, including 7 new oracle-named tests for exactly the behaviors changed here. If Codex limits reset and a review later posts findings on the merged change, they belong on issue #6515 as a fix-forward.

@dezren39
dezren39 merged commit c64a02f into main Nov 10, 2026
2 of 5 checks passed
@dezren39
dezren39 deleted the queue/11464-6515-broker-transport-hardening branch November 10, 2026 00:51
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 brokers: review-finding hardening for dual-bind transports (from PR #6514)

1 participant