Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions js/net/src/lite/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions quest/m0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 0 additions & 46 deletions quest/m0/lite-setup-backport.md

This file was deleted.

70 changes: 42 additions & 28 deletions rs/moq-net/src/lite/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
);
}
}
}

Expand Down
Loading