Skip to content

client: cap-0 explicit ranges longer than the 1 TiB sizing ceiling truncate or overfetch #2865

Closed

Description

@yigitdot

Follow-up to #2864 (issue #2843). The cap-free sizing ceiling (UNCAPPED_SIZING_CEILING, 1 TiB) bounds how far past the furthest requested range start the planner sizes its work. Growth past it is driven by the grow loop, which only runs for tail targets, so with max_blob_bytes = 0 an explicit single range longer than 1 TiB behaves differently from a whole-blob fetch:

  • Bounded streamer window (Streamer::open_range with len > 1 TiB into a larger blob): Want::new clips the range to offset + 1 TiB and marks it non-tail, so the acquire returns Ok at that prefix and the reader fails with "stream fetch finished with X of Y bytes readable" after 1 TiB has been delivered and paid.
  • Unbounded downloader range (DownloadTarget.ranges with len ≥ 1 TiB): the clipped end makes the range pass reaches_end, so it is reclassified as a tail and the fetch grows to the blob's true end — paying for bytes past the requested end (the bundle donor-splice path would fetch donor bytes).

Exposure is narrow: cap 0 is an explicit opt-out in the CLI and the bundle engine (both default to a 1 TiB cap) and only the SDK defaults to it; the gateway always passes a positive cap, and decdn get never sets a range. The limit is documented on the ceiling const and in the PR body.

Widening the reach by the caller's range ends is NOT a safe fix: range lengths are often claim-derived (e.g. a whole-blob range built from the probe hint), which reopens the unbounded-sizing DoS #2843 fixed. A fix likely needs to distinguish truly caller-chosen ends, or a typed error when a cap-0 range is clipped at the ceiling.

While in the area, two small doc sites out of #2864's scope:

  • crates/cli/src/commands/fetch.rs ~1397: the prove_size → Ok(None) log says "the claim's last chunk group is not the blob's last"; a claim past the cap or the cap-0 ceiling also lands there — reword to cover both.
  • crates/common/src/cli/fetch.rs --max-blob-mb help: could state that 0 still sizes work from at most 1 TiB past the requested offset.

🤖 Generated with Claude Code

Activity

  1. added
    kind:bug
    area:client
    design:missing-decision
    prio:low
    on Nov 11, 2026
  2. moved this from Backlog to In progress in deCDNon Nov 11, 2026
  3. added a commit that references this issue on Nov 11, 2026
    ee89b63
  4. yigitdot commented on Nov 11, 2026

    @yigitdot
    ContributorAuthor

    PR #2864 fixes this in ee89b63. A range is now a tail only when it reaches the caller's raw claim. Every other range that ends past the bound grows the bound as its bytes verify, but never past its own end or the claim. A cap-0 window longer than the ceiling therefore completes, and an unbounded range no longer fetches past its end. The prove_size log reword landed in the same commit. The --max-blob-mb help nit moved to #2875.

    🤖 Generated with Claude Code

  5. yigitdot commented on Nov 13, 2026

    @yigitdot
    ContributorAuthor

    Fixed by #2885: Want::new keeps a requested end on any range with a length and clips it to the bound — only a zero-length range is a tail (the doc on Want::new cites this issue). The cap-0 claim-sizing machinery this issue describes (UNCAPPED_SIZING_CEILING, the grow loop) is deleted: sizes are proven before planning.

  6. moved this from In progress to Done in deCDNon Nov 13, 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

    area:clientdesign:missing-decisionkind:bugprio:low

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions