Skip to content

Design: validate it where you read it — one validated-and-bounded contract for the fleet proxy's frame and peer values #6582

Open
0 of 5 issues completed

Description

@dezren39

Design: validate it where you read it — one validated-and-bounded contract for the fleet proxy's frame and peer values

Design doc: files/designs/code-fleet-proxy-validated-bounded.md in the keep-the-four-repos-healthy goal workspace. Audit at origin/main b0c472d94. Filed by the design architect (pass 62, 2026-11-06), originating on the trigger recorded at pass 61: a fifth fleet-proxy bound/validation surface files — #6518 filed the same day, the token_file sibling of #6516 in the same function.

Summary

The fleet proxy (pkgs/fleet/crates/fleet-proxy) and its sibling client (pkgs/fleet/crates/fleet-dispatch) read two kinds of values they do not control: request frames from local callers (serve.rs parse_request) and HTTP responses from laptop services (http.rs, connect_udp.rs, dispatch's lib.rs). The stated doctrine (#5579, http.rs module doc) is that peer-declared sizes are never trusted — and sizes are capped (MAX_RESPONSE_BODY_BYTES, MAX_LINE_BYTES, strict Content-Length). But the doctrine was never extended past sizes:

The contract

Every value the proxy acts on is validated where it is read — type, range, arithmetic, count — and a present-but-invalid value is refused in that surface's own error shape, never defaulted, substituted, wrapped, or consumed without bound.

  1. Present is not absent (frame fields). parse_request distinguishes absent (documented default) from present-but-invalid (refused with the standard {status: 502, body: {error: "broker: …"}} frame naming the field and bad shape; no connection opened, no token read) — fleet-proxy(broker): method/path CRLF injection — one frame smuggles a second request onto the pooled tunnel #5750's strictness extended to every field the broker acts on.
  2. Counts are bounds too (peer readers). Every repetition loop over peer-controlled units carries a named count bound; exceeding it fails like a size cap (HttpError::Malformed, connection non-reusable).
  3. Arithmetic is checked, during the read. A declared size is checked and capped before it is added, indexed, or allocated from; bounds are enforced while accumulating, not after (fleet-proxy(connect-udp): request-head bound is checked only after a whole line arrives — one newline-free line accumulates without limit #6511's landed fix is the embodiment).
  4. One statement. The contract is written into the http.rs module doc's peer-trust paragraph, extended from sizes to all four dimensions (lands with Phase 2, where the doc is).

Decisions recorded on this issue

Phased breakdown (sub-issues of this issue)

Phases with open questions stay in the design doc (hello-frame field treatment, a shared bound-constant home, refusal-count visibility) — they are not issues.

Grounding

Agent note: this is a kind/design issue from the fleet design architect. Its phases are its sub-issues; triage of the phases should record the phase structure rather than re-filing or re-scoping the contract — the two pins above (port 0 refused; null token_file = absent) are decided here.

Activity

  1. added
    epicMeta-issue grouping multiple items (org Project Type=Epic)
    kind/designA design proposal (design-architect): multi-step, phased, decision-bearing
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    Contributor
  3. added
    app/fleetpkgs/fleet multicall binary + platform crates
    on Nov 6, 2026
  4. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · design-architect pass 62 — design filed this pass

  5. added
    queue/queuedHas a queued task in the Supabase agent queue
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/fleetpkgs/fleet multicall binary + platform cratesepicMeta-issue grouping multiple items (org Project Type=Epic)kind/designA design proposal (design-architect): multi-step, phased, decision-bearingqueue/queuedHas a queued task in the Supabase agent queuesource/design-architectFiled by the repo design architect jobstatus/needs-triageNot yet triaged; needs a first looktask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions