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
node: buyer-side pull buffers up to server-claimed total_bytes with no blob-size ceiling (asymmetric with serving-side BlobTooLarge gate) #840
kind:bugSomething does not behave as documentedkind:securitySecurity impact; report a vulnerability to [email protected], not hereprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Surfaced by a full-repository review (2026-06-09).
Finding
The node-to-node pull in stream_fetch (crates/node/src/client_requester.rs:208-267) accumulates up to expected = total_bytes − byte_offset bytes into a BytesMut with no independent ceiling. total_bytes is fully server-controlled, and StreamResponse::validate() (crates/protocol/src/client.rs:362) does not bound it — it checks rate/signature/ok-consistency only. The loop's cumulative > expected guard caps growth at the server's promise, not at a sane maximum, and the allocation happens before any hash check.
The serving side already enforces the inverse gate (BlobTooLarge at client.rs:519); the buying side does not.
Impact
A malicious or buggy selected upstream provider can drive the buying node toward OOM with one oversized total_bytes claim. Partly self-limiting (the buyer pays vouchers per interval and selected the provider), but a single oversized response allocates before payment or hash verification bounds it.
Fix
Thread the node's max_blob_size_bytes (already plumbed into ClientHandler) into stream_fetch and reject total_bytes above it before entering the receive loop, mirroring the serving-side gate.
Asymmetric blob-size enforcement in the node-to-node pull path: the serving side already gates on BlobTooLarge (crates/protocol/src/client.rs:519), but the buying side (stream_fetch in client_requester.rs:208-267) allocates a BytesMut sized to the server's claimed total_bytes before any hash check. A malicious or misconfigured upstream can claim an arbitrarily large total_bytes and drive the buying node toward OOM. The fix is well-specified: thread max_blob_size_bytes (already available in ClientHandler) into stream_fetch and reject oversized claims before entering the receive loop.
📊 Assessment
Dimension
Value
Reasoning
Type
Bug
Security vulnerability in a core network path — missing input validation on an untrusted server-supplied field
Labels
rust added; bug, security, medium retained
Rust implementation fix; existing priority/classification labels are appropriate — "medium" is reasonable given partial self-limiting (buyer selects provider, pays per interval)
Coding agent
Suitable
Clear location (client_requester.rs:stream_fetch), well-defined fix with an existing mirror pattern on the serving side, regression test anchor in #746
crates/protocol/src/client.rs:362 — StreamResponse::validate() checks rate/signature/ok-consistency only; does not bound total_bytes
crates/protocol/src/client.rs:519 — serving-side BlobTooLarge gate to mirror
Suggested fix checklist:
Add max_blob_size_bytes: u64 parameter to stream_fetch (or resolve it from context already available in ClientHandler)
Before the receive loop, check if total_bytes - byte_offset > max_blob_size_bytes { return Err(...) } — reject early, no allocation
Optionally: move the bound check into StreamResponse::validate() if max_blob_size_bytes can be passed there, to keep validation centralised
Add a regression test under #746's integration test scaffolding: a mock upstream that returns an oversized total_bytes claim should be rejected with a protocol error, not an OOM
Severity context:
The "partly self-limiting" note in the issue is valid — the buyer has to actively select this provider and open a payment channel before the oversized response can be returned. However, the allocation precedes hash verification and payment settlement, so a rogue/buggy node in the provider table can still exploit the window. The medium label is appropriate; if PoC deployment is on shared infrastructure, maintainers may want to reconsider poc-blocking.
kind:bugSomething does not behave as documentedkind:securitySecurity impact; report a vulnerability to [email protected], not hereprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon Jun 9, 2026
🎯 Triage report
Asymmetric blob-size enforcement in the node-to-node pull path: the serving side already gates on
BlobTooLarge(crates/protocol/src/client.rs:519), but the buying side (stream_fetchinclient_requester.rs:208-267) allocates aBytesMutsized to the server's claimedtotal_bytesbefore any hash check. A malicious or misconfigured upstream can claim an arbitrarily largetotal_bytesand drive the buying node toward OOM. The fix is well-specified: threadmax_blob_size_bytes(already available inClientHandler) intostream_fetchand reject oversized claims before entering the receive loop.📊 Assessment
rustadded;bug,security,mediumretainedclient_requester.rs:stream_fetch), well-defined fix with an existing mirror pattern on the serving side, regression test anchor in #746🔗 Similar issues
cdn/client/v1node-to-node paid pull-through); the OOM regression test for this fix belongs there💡 Notes and suggestions
Root cause location:
crates/node/src/client_requester.rs:208-267—stream_fetchreceive loop;expected = total_bytes − byte_offsetdrivesBytesMutgrowthcrates/protocol/src/client.rs:362—StreamResponse::validate()checks rate/signature/ok-consistency only; does not boundtotal_bytescrates/protocol/src/client.rs:519— serving-sideBlobTooLargegate to mirrorSuggested fix checklist:
max_blob_size_bytes: u64parameter tostream_fetch(or resolve it from context already available inClientHandler)if total_bytes - byte_offset > max_blob_size_bytes { return Err(...) }— reject early, no allocationStreamResponse::validate()ifmax_blob_size_bytescan be passed there, to keep validation centralised#746's integration test scaffolding: a mock upstream that returns an oversizedtotal_bytesclaim should be rejected with a protocol error, not an OOMSeverity context:
The "partly self-limiting" note in the issue is valid — the buyer has to actively select this provider and open a payment channel before the oversized response can be returned. However, the allocation precedes hash verification and payment settlement, so a rogue/buggy node in the provider table can still exploit the window. The
mediumlabel is appropriate; if PoC deployment is on shared infrastructure, maintainers may want to reconsiderpoc-blocking.Add this agentic workflows to your repo
To install this agentic workflow, run
fix(node): reject total_bytes below byte_offset on resumed pulls (#840)
fix(node): reject short (truncated) deliveries on resumed pulls (#840)
fix(node): bound buyer-side pull to max_blob_size, reject oversized t…