From c82f9c7af80d1ebf2b98aaf9ddaafa2b966ae212 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 29 Sep 2026 15:43:16 -0700 Subject: [PATCH 1/5] quest(auth): AUTH protocol violations close the session everywhere Co-Authored-By: Claude Opus 5.5 --- quest/m1/auth/README.md | 1 + quest/m1/auth/violations.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 quest/m1/auth/violations.md diff --git a/quest/m1/auth/README.md b/quest/m1/auth/README.md index b9d2c27a090..27d85b944ae 100644 --- a/quest/m1/auth/README.md +++ b/quest/m1/auth/README.md @@ -90,6 +90,7 @@ existing lite-06 ALPN. ## Required - [AUTH endings](/quest/m1/auth/error-codes.md) - an out-of-range AUTH_ERROR code is refused, and both sides settle and recompute grants when a stream ends +- [AUTH violations](/quest/m1/auth/violations.md) - every AUTH protocol violation closes the session in Rust and JS, lite and IETF - [Origin narrowing](/quest/m1/auth/narrowing.md) - a live grant narrows in place: subscriptions outside it reset, publishes outside it abort, and relay revalidation stops closing the session diff --git a/quest/m1/auth/violations.md b/quest/m1/auth/violations.md new file mode 100644 index 00000000000..c07bdf9f1a1 --- /dev/null +++ b/quest/m1/auth/violations.md @@ -0,0 +1,31 @@ +# [S] AUTH protocol violations close the session everywhere + +## Goal + +Every AUTH stream message that the lite or IETF drafts call a +PROTOCOL_VIOLATION closes the session in Rust and `@moq/net` alike, instead +of ending only its token. Examples: an AUTH_ERROR code past `u32`, an +out-of-range AUTH_OK expiry, or an AUTH_OK or AUTH_ERROR that fails to decode, +such as a bad pattern. + +## Plan + +[AUTH endings](/quest/m1/auth/error-codes.md) (#4550) closes the session only +on an explicit `ProtocolViolation` in Rust lite, and left three gaps: + +- JS reports the exact oversized code but doesn't close the session. Let the + JS connection close on an `AuthSession` protocol violation. +- An out-of-range IETF AUTH_OK expiry still ends only its token. +- An AUTH_OK or AUTH_ERROR that fails to decode ends only the token, like + every other lite stream, although the draft calls a bad pattern a + PROTOCOL_VIOLATION. + +Close the session on each, in both languages and on both protocols, with one +regression test per case, and check the lite and IETF draft text agrees. Run +`just test interop --all`. + +Public API: none. Wire: none beyond draft wording. + +## Related + +- [AUTH endings](/quest/m1/auth/error-codes.md) - the Rust lite case this generalizes From 8b26a0ee055b4d45442de2c0eee1b2cf1b5d7442 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 29 Sep 2026 15:55:53 -0700 Subject: [PATCH 2/5] quest(auth): cover a malformed inbound AUTH too Co-Authored-By: Claude Opus 5.5 --- quest/m1/auth/violations.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/quest/m1/auth/violations.md b/quest/m1/auth/violations.md index c07bdf9f1a1..f04a20f7b9f 100644 --- a/quest/m1/auth/violations.md +++ b/quest/m1/auth/violations.md @@ -5,13 +5,13 @@ Every AUTH stream message that the lite or IETF drafts call a PROTOCOL_VIOLATION closes the session in Rust and `@moq/net` alike, instead of ending only its token. Examples: an AUTH_ERROR code past `u32`, an -out-of-range AUTH_OK expiry, or an AUTH_OK or AUTH_ERROR that fails to decode, -such as a bad pattern. +out-of-range AUTH_OK expiry, or an AUTH, AUTH_OK, or AUTH_ERROR that fails to +decode, such as a bad pattern or length. ## Plan [AUTH endings](/quest/m1/auth/error-codes.md) (#4550) closes the session only -on an explicit `ProtocolViolation` in Rust lite, and left three gaps: +on an explicit `ProtocolViolation` in Rust lite, and left four gaps: - JS reports the exact oversized code but doesn't close the session. Let the JS connection close on an `AuthSession` protocol violation. @@ -19,6 +19,9 @@ on an explicit `ProtocolViolation` in Rust lite, and left three gaps: - An AUTH_OK or AUTH_ERROR that fails to decode ends only the token, like every other lite stream, although the draft calls a bad pattern a PROTOCOL_VIOLATION. +- On the acceptor side, a presenter's AUTH that fails to decode only aborts + its stream (Rust lite `AuthServe`, JS `#runBidis`), so a peer can repeat + malformed AUTH streams without closing the session. Close the session on each, in both languages and on both protocols, with one regression test per case, and check the lite and IETF draft text agrees. Run From f211e7b6cabcccaf67aecf17586c9348fecac8d2 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 29 Sep 2026 16:22:04 -0700 Subject: [PATCH 3/5] quest(auth): validate the IETF AUTH request ID too Co-Authored-By: Claude Opus 5.5 --- quest/m1/auth/violations.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/quest/m1/auth/violations.md b/quest/m1/auth/violations.md index f04a20f7b9f..01ae990e25d 100644 --- a/quest/m1/auth/violations.md +++ b/quest/m1/auth/violations.md @@ -11,7 +11,7 @@ decode, such as a bad pattern or length. ## Plan [AUTH endings](/quest/m1/auth/error-codes.md) (#4550) closes the session only -on an explicit `ProtocolViolation` in Rust lite, and left four gaps: +on an explicit `ProtocolViolation` in Rust lite. These gaps remain: - JS reports the exact oversized code but doesn't close the session. Let the JS connection close on an `AuthSession` protocol violation. @@ -22,6 +22,9 @@ on an explicit `ProtocolViolation` in Rust lite, and left four gaps: - On the acceptor side, a presenter's AUTH that fails to decode only aborts its stream (Rust lite `AuthServe`, JS `#runBidis`), so a peer can repeat malformed AUTH streams without closing the session. +- Both IETF AUTH acceptors (Rust `Serve::run`, JS `IetfAuthWire.accept`) + discard the decoded Request ID, so a reused ID is accepted. Validate it like + every other request, where a duplicate is session-fatal. Close the session on each, in both languages and on both protocols, with one regression test per case, and check the lite and IETF draft text agrees. Run From 5af62799dfb4b80eb5be56d3c61158dadadfa988 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 29 Sep 2026 16:53:46 -0700 Subject: [PATCH 4/5] quest(auth): unknown reply types and a second AUTH, and audit the rest Co-Authored-By: Claude Opus 5.5 --- quest/m1/auth/violations.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/quest/m1/auth/violations.md b/quest/m1/auth/violations.md index 01ae990e25d..204aa3da7a1 100644 --- a/quest/m1/auth/violations.md +++ b/quest/m1/auth/violations.md @@ -1,4 +1,4 @@ -# [S] AUTH protocol violations close the session everywhere +# [M] AUTH protocol violations close the session everywhere ## Goal @@ -25,6 +25,14 @@ on an explicit `ProtocolViolation` in Rust lite. These gaps remain: - Both IETF AUTH acceptors (Rust `Serve::run`, JS `IetfAuthWire.accept`) discard the decoded Request ID, so a reused ID is accepted. Validate it like every other request, where a duplicate is session-fatal. +- An AUTH reply of an unknown type (neither AUTH_OK nor AUTH_ERROR) fails + the type dispatch before either decoder runs, and ends only the token. +- A second AUTH on an open IETF AUTH stream is never read: after the first, + Rust `Serve::run` and JS `AuthSession.serve` wait only for the stream to + close. Treat it like a repeated PUBLISH_NAMESPACE, a duplicate request. + +This list comes from review, not a full audit. Walk every AUTH read path on +both sides, both protocols, and both languages, and fold in anything missing. Close the session on each, in both languages and on both protocols, with one regression test per case, and check the lite and IETF draft text agrees. Run From 95c01d1720769341741c15861892b40015b5729e Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 29 Sep 2026 17:36:54 -0700 Subject: [PATCH 5/5] quest(auth): JS fetchGroup stops when its grant is revoked Co-Authored-By: Claude Opus 5.5 --- quest/m1/auth/README.md | 1 + quest/m1/auth/js-fetch-watch.md | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 quest/m1/auth/js-fetch-watch.md diff --git a/quest/m1/auth/README.md b/quest/m1/auth/README.md index 27d85b944ae..f8e909b7d1c 100644 --- a/quest/m1/auth/README.md +++ b/quest/m1/auth/README.md @@ -91,6 +91,7 @@ existing lite-06 ALPN. - [AUTH endings](/quest/m1/auth/error-codes.md) - an out-of-range AUTH_ERROR code is refused, and both sides settle and recompute grants when a stream ends - [AUTH violations](/quest/m1/auth/violations.md) - every AUTH protocol violation closes the session in Rust and JS, lite and IETF +- [JS fetch grant watch](/quest/m1/auth/js-fetch-watch.md) - a JS `fetchGroup` ends `Unauthorized` when its path leaves the grant - [Origin narrowing](/quest/m1/auth/narrowing.md) - a live grant narrows in place: subscriptions outside it reset, publishes outside it abort, and relay revalidation stops closing the session diff --git a/quest/m1/auth/js-fetch-watch.md b/quest/m1/auth/js-fetch-watch.md new file mode 100644 index 00000000000..4362cbd6ad2 --- /dev/null +++ b/quest/m1/auth/js-fetch-watch.md @@ -0,0 +1,14 @@ +# [XS] JS fetchGroup stops when its grant is revoked + +## Goal + +A `@moq/net` subscriber-side `fetchGroup` holds a grant watch from its first +check to its end, as subscriptions do, so a fetch whose path leaves the +session's grant ends with `Unauthorized` instead of finishing. + +## Plan + +Found by [Origin narrowing](/quest/m1/auth/narrowing.md) (#4560), which gave +every other JS request a watch armed before its first await. Follow the same +pattern, and add a regression test where the grant changes during setup and +mid-fetch.