diff --git a/js/net/src/lite/connection.test.ts b/js/net/src/lite/connection.test.ts index f08cc5ff52c..6e1233555d6 100644 --- a/js/net/src/lite/connection.test.ts +++ b/js/net/src/lite/connection.test.ts @@ -134,6 +134,21 @@ for (const [alpn, version] of [ connection.abort(); } }); + + test(`repeated SETUP parameter closes ${alpn} with PROTOCOL_VIOLATION`, async () => { + const pair = createMockTransportPair(alpn); + const connection = new Connection({ url: new URL("https://relay.example/"), quic: pair.client, version }); + try { + const writer = await Writer.open(pair.server, { version }); + await writer.u53(DataType.Setup); + // A five-byte body holding two empty parameters with the same id. + for (const v of [5, 2, 0, 0, 0, 0]) await writer.u53(v); + writer.close(); + expect((await pair.client.closed).closeCode).toBe(SessionCode.ProtocolViolation); + } finally { + connection.abort(); + } + }); } // Once enabled, hold the FIN acknowledgement of every stream `transport` writes on (unidirectional diff --git a/quest/m0/README.md b/quest/m0/README.md index 415c90f0003..bed191fabb1 100644 --- a/quest/m0/README.md +++ b/quest/m0/README.md @@ -87,8 +87,6 @@ have fixes on `main`: macOS tests (#5335), drill-sensitivity (#5338), loom - [Refusal close backport](/quest/m0/refusal-close-backport.md) - `release` reports a refused browser session as `unauthorized`, never "Connection lost" -- [Lite SETUP backport](/quest/m0/lite-setup-backport.md) - `release` closes a moq-lite session on a repeated SETUP parameter or a second Setup Stream, in a later 0.14.x patch (#5521) - - [CI cost and latency](/quest/m0/ci/README.md) - PRs stop queueing behind hosted runner caps: macOS and Windows move to the merge queue, caches move to R2, and setup is skipped when no work is selected - [Draft-22 media on 0.17](/quest/m0/release-22/README.md) - a 0.17.x with the LOCATION_FILTER and FIRST_OBJECT fixes and moq-noq 1.3.5, then a patch with draft-20+ FETCH and the unset-clock and quiet-edge fixes - [nixpkgs ships the lld fix](/quest/m0/nixpkgs-lld-fix.md) - waiting on NixOS/nixpkgs#568680 to reach `nixpkgs-unstable`, which the release build fix bumps to diff --git a/quest/m0/lite-setup-backport.md b/quest/m0/lite-setup-backport.md deleted file mode 100644 index 92d9b94d887..00000000000 --- a/quest/m0/lite-setup-backport.md +++ /dev/null @@ -1,46 +0,0 @@ -# [S] Backport the Lite SETUP violation closes to release - -## Goal - -On `release`, a moq-lite peer that repeats a SETUP Parameter ID or opens a -second Setup Stream gets the session closed with PROTOCOL_VIOLATION (0x3), as -`drafts/draft-lcurley-moq-lite.md` requires, so a later 0.14.x CLI and 0.3.x -moq-net patch pass moq-dev/smoke's moq-lite conformance rows -L06-7-3-MUST-112 and L06-6-3-1-MUST-092. - -## Plan - -Reported in [#5521](https://github.com/moq-dev/moq/issues/5521) against `moq` -0.14.4. Verified 2026-10-15 that `main` already closes both cases: - -- A second Setup Stream: `PeerSetup::claim` (`rs/moq-net/src/lite/setup.rs`) - claims the slot as soon as the stream type is Setup, from 7ddfa101b in - #4704. Tests: `duplicate_setup_closes_the_session`, - `accept_setup_refuses_two_incomplete_setup_streams`, - `accepted_lite_setup_refuses_a_second_setup_stream`. -- A SETUP that fails to decode (a duplicate parameter returns - `DecodeError::Duplicate`): the `UniServe` Err branch in - `rs/moq-net/src/lite/subscriber.rs` returns ProtocolViolation, from - 0f6a8d1f9 in #4704. No test sends a repeated Parameter ID. - -On `release`, `UniServe` aborts a stream that fails to decode and returns -`Ok`, and `peer_setup.set` overwrites a second SETUP. The server's -`accept_setup` path already maps a decode error to ProtocolViolation there. - -Decided 2026-10-15 (maintainer): - -- One PR onto `release` (CONTRIBUTING) that ports only the two closes: the - `PeerSetup` claim and the close on a SETUP decode error, with their tests. - Not the rest of #4704 (early stream retention) or #5550. -- Add a repeated-Parameter-ID regression test on both `main` and `release`, - one that fails without the close. Check whether js/net closes on a repeated - parameter too; if it does not, report it as a follow-up rather than - widening this backport. -- The crate patch bumps happen at the release cut, not in this PR. - -Public API: none. Wire: none (`release` starts enforcing rules the draft -already states). - -## Closes - -- [#5521](https://github.com/moq-dev/moq/issues/5521) - moq-lite-06: a repeated SETUP parameter or a second Setup Stream does not close the session diff --git a/rs/moq-net/src/lite/session.rs b/rs/moq-net/src/lite/session.rs index 4395977ff34..1325bcd2f55 100644 --- a/rs/moq-net/src/lite/session.rs +++ b/rs/moq-net/src/lite/session.rs @@ -1121,10 +1121,10 @@ mod tests { } } - /// A SETUP that ends before its body decodes leaves nothing to wait on, since the - /// Setup Stream is already claimed. + /// A SETUP that fails to decode leaves nothing to wait on, since the Setup Stream is + /// already claimed. #[moq_net_sim::test] - async fn truncated_setup_closes_the_session() { + async fn malformed_setup_closes_the_session() { for version in [Version::Lite05, Version::Lite06, Version::Lite07] { let mut truncated = Vec::new(); DataType::Setup @@ -1133,31 +1133,45 @@ mod tests { version, ) .unwrap(); - let session = - crate::lite::test_transport::ScriptedSession::eof(Vec::new()).with_incoming_unis(vec![truncated]); - let log = session.log.clone(); - let mut started = start(Config { - runtime: crate::time::Clock::sim(), - session, - setup_stream: None, - publish: None, - subscribe: None, - peer_hop: None, - version, - our_setup: Setup::default(), - peer_setup: None, - client: false, - auth: crate::auth::Handle::new(version.has_auth()), - limits: Default::default(), - }) - .unwrap(); - let _ = started.driver.poll(&kio::Waiter::noop()); - assert!( - log.closes() - .iter() - .any(|(code, _)| *code == SessionError::ProtocolViolation.to_code()), - "{version:?}: a truncated SETUP must close the session" - ); + + // Two empty parameters with the same ID. + let mut repeated = truncated.clone(); + let mut w = crate::coding::Encoder::new(&mut repeated, version.into()); + let prefix = w.prefix_varint(); + w.varint(2).unwrap(); + for _ in 0..2 { + w.varint(0).unwrap(); + w.bytes(&[]).unwrap(); + } + w.fill(prefix).unwrap(); + + for (case, setup) in [("truncated", truncated), ("repeated parameter", repeated)] { + let session = + crate::lite::test_transport::ScriptedSession::eof(Vec::new()).with_incoming_unis(vec![setup]); + let log = session.log.clone(); + let mut started = start(Config { + runtime: crate::time::Clock::sim(), + session, + setup_stream: None, + publish: None, + subscribe: None, + peer_hop: None, + version, + our_setup: Setup::default(), + peer_setup: None, + client: false, + auth: crate::auth::Handle::new(version.has_auth()), + limits: Default::default(), + }) + .unwrap(); + let _ = started.driver.poll(&kio::Waiter::noop()); + assert!( + log.closes() + .iter() + .any(|(code, _)| *code == SessionError::ProtocolViolation.to_code()), + "{version:?}, {case}: SETUP must close the session" + ); + } } }