Repository navigation
Conversation
Port of quinn-rs/quinn@fed0321a (quinn-rs/quinn#2694, RUSTSEC-2026-0185): a peer sending small gapped STREAM or CRYPTO frames could make the assembler buffer an unbounded number of chunks. After defragmenting, more than 1024 chunks now closes the connection with INTERNAL_ERROR. Co-Authored-By: Luke Curley <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port of quinn-rs/quinn@4b88c940 (quinn-rs/quinn#2789). The cap above was only checked inside the over-allocation branch, so gapped frames whose allocation matches their length, or frames handled entirely by the unordered dedup loop, still grew the chunk count without bound. Compact once the count passes twice the cap and reject only if compaction cannot bring it back under. Co-Authored-By: Luke Curley <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port of quinn-rs/quinn@c3f8b098 (quinn-rs/quinn#2814). defragment now combines contiguous chunks smaller than buffered / MAX_CHUNKS, so a large stream_receive_window with a slow in-order reader no longer trips TooManyChunks on lossless data. Chunks above the minimum size are left alone so they are not copied on every compaction. Co-Authored-By: Luke Curley <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
noq-proto 1.3.0 forked before quinn-proto bounded how many chunks a stream's or CRYPTO's assembler holds, so a peer sending small frames with gaps could grow a client's or a worker's memory without limit, and the crate's new name hides the advisory from cargo audit. Take n0-computer/noq#828 as patch 18, unchanged: insert refuses past 1024 chunks left after defragmenting, which closes the connection with INTERNAL_ERROR, and contiguous small chunks coalesce so a slow reader on a large window is not refused. Co-Authored-By: Claude Code
* Bound what a QUIC peer can make an iroh endpoint buffer Take noq-proto from the head of n0-computer/noq#828, which ports quinn's cap on out-of-order chunks per stream (RUSTSEC-2026-0185), until n0 releases it. Every bifrost-iroh bind now applies one QUIC config: no unidirectional streams, no application datagrams, and a 16 MiB connection receive window. * Tell embedders to carry the noq-proto patch themselves * Drain what each stream sent in the connection budget test Read back exactly the bytes each stream took, until past the eighth of the window that makes noq announce freed room, so a stream that stalled early cannot hang the drain. Stop opening streams once one takes nothing with the window nearly full. Count both stream directions in the window's why-comment, and say the limits do not reach iroh's own address-discovery connection to a relay.
* Take the bounded noq-proto and bifrost's QUIC limits Pin bifrost 3d1f79e, where every bifrost-iroh bind allows a peer no unidirectional streams, no datagrams, and 16 MiB of unread stream data per connection. Patch noq-proto to the head of n0-computer/noq#828, which ports quinn's cap on out-of-order chunks per stream (RUSTSEC-2026-0185): cargo honours a patch only at the workspace root, so bifrost's own patch does not reach this build. Allow that one git source in deny.toml until n0 releases the fix. * Check advisories in CI and watch the crates our forks copy A daily, push and pull-request workflow runs cargo-deny's advisory check, pinned to a cargo-deny that loads CVSS 4.0 entries, and the fork watch from bifrost, which fails when an advisory filed against quinn, quinn-proto or quinn-udp has no row saying how our fork stands. Move rustls to 0.23.45 (RUSTSEC-2026-0285). Ignore the unmaintained notices for paste and proc-macro-error2, build-time proc macros, with their reasons. * Tell workspaces that depend on tightbeam to patch noq-proto
* Take the bounded noq-proto and check advisories in CI Pin bifrost 3d1f79e, tightbeam de0b58d and services f1a2ef6. bifrost now allows a peer no unidirectional streams, no datagrams, and 16 MiB of unread stream data per connection; services builds russh without rsa, so the rsa crate (RUSTSEC-2023-0071) leaves the graph. Patch noq-proto to the head of n0-computer/noq#828, which ports quinn's cap on out-of-order chunks per stream (RUSTSEC-2026-0185): cargo honours a patch only at the workspace root, so the siblings' patches do not reach this build. Allow that one git source in deny.toml until n0 releases the fix. Add a daily, push and pull-request workflow that runs cargo-deny's advisory check, pinned to a cargo-deny that loads CVSS 4.0 entries, and the fork watch from bifrost, which fails when an advisory filed against quinn, quinn-proto or quinn-udp has no row saying how our fork stands. Move rustls to 0.23.45 (RUSTSEC-2026-0285). Ignore the unmaintained notices for paste and proc-macro-error2, build-time proc macros, with their reasons. * Say what a machine could do to swoosh before the bounded noq-proto
|
Thanks for porting these. The first two commits landed via #823 and shipped in 1.4.0, but the coalescing one didn't, so on 1.4.0 a receiver that stops reading for a bit gets disconnected with "too many gaps in stream buffer" after 2,048 packets, with no actual gaps. Packet-sized chunks get marked defragmented and are never merged again, so compaction can't get under This branch fixes it and matches quinn 0.11.18. It only needs a rebase down to the last commit. A 1.4.x patch with it would be great. ReproFails on 1.4.0 and #[test]
fn in_order_stream_is_not_rejected() {
let mut x = Assembler::new();
let data = Bytes::from(vec![0; 1200]);
let mut offset = 0u64;
for i in 0..14000 {
if x.insert(offset, data.clone(), 1200).is_err() {
panic!("rejected after {i} packets");
}
offset += 1200;
}
}Not covered here: quinn-rs/quinn#2955 (still open upstream) and the unordered-mode bug in #865. |
|
Hi @thtbee, it feel free to take over this and create a PR for the remaining commit in a new PR. Just mention that it replaces this one. Thanks! |
|
replaced, see comments above for links |
…#866) ## Description Replaces n0-computer#828, as discussed there. The first two commits of that PR landed in n0-computer#823, so this is the remaining one: the port of quinn-rs/quinn#2814, adapted to the sorted `VecDeque` from n0-computer#823. Without it, 1.4.0 can close a connection with "too many gaps in stream buffer" when a reader falls about 2,048 packets behind, even with no gaps. Packet-sized chunks get marked defragmented and are never merged again, so compaction can't get back under `MAX_CHUNKS`. `defragment` now also merges contiguous chunks smaller than `buffered / MAX_CHUNKS` (at least 128 bytes), like quinn. Brings over quinn's two tests. `ordered_lossless_stream_is_not_rejected` fails on `main` and passes here. ## API Changes None. ## Notes & open questions quinn-rs/quinn#2955 (contiguous data behind a single gap under sustained loss) is still open upstream and isn't covered here. This touches `defragment` like n0-computer#867 (the fix for n0-computer#865), so whichever lands second needs a small rebase. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant. - [x] All API changes documented. - [x] `cargo make` passes locally. Co-authored-by: Eanna Lyons <[email protected]> Co-authored-by: Luke Curley <[email protected]> Co-authored-by: Floris Bruynooghe <[email protected]>
Description
Ports quinn's fix for RUSTSEC-2026-0185 (CVE-2026-25800, GHSA-4w2j-m93h-cj5j) to
noq-proto. A peer sending small gapped STREAM or CRYPTO frames can make theAssemblerbuffer an unbounded number of chunks while the reader waits for the missing prefix. noq-proto 1.3.0 predates the fix, andcargo auditcannot flag it because the crate is renamed.Three commits, one per quinn commit on the
0.11.xline, authorship kept:fed0321a, quinn-proto 0.11.15):Assembler::insertreturnsTooManyChunkswhen more than 1024 chunks remain after defragmenting; the stream and CRYPTO paths close the connection withINTERNAL_ERROR.4b88c940, 0.11.17): the cap in (1) is only checked when over-allocation is high, so gapped frames whose allocation equals their length bypass it. Also compact once the count passes 2x the cap.c3f8b098, 0.11.18): coalesce small contiguous chunks during defragment, so (2) does not reject lossless data on a largestream_receive_windowwith a slow reader.(1) alone is bypassable, and (2) without (3) can reject a legitimate stream, so they go together. The result matches quinn-proto 0.11.18's assembler logic; the heap-to-
VecDequerefactor on quinnmainis not included.API Changes
None. Wire: a peer that exceeds the chunk cap is closed with
INTERNAL_ERROR.Notes & open questions
defragmentstarts atbytes_readwhere quinn starts at 0. The three commits apply unchanged on top..unwrap()on existinginsertcalls, including the proptest.Change checklist
proposed change and wrote an as clear and concise description as
they could.
intented effect.
cargo makepasses locally. (cargo test -p noq-protoandcargo clippy -p noq-proto --all-targets -- -D warningspass.)Opened on behalf of the moq-dev/noq fork, which carries the same commits.
(Written by Claude Opus 5.5)
🤖 Generated with Claude Code