diff --git a/quest/m1/auth/README.md b/quest/m1/auth/README.md index b9d2c27a090..f8e909b7d1c 100644 --- a/quest/m1/auth/README.md +++ b/quest/m1/auth/README.md @@ -90,6 +90,8 @@ 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 +- [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. diff --git a/quest/m1/auth/violations.md b/quest/m1/auth/violations.md new file mode 100644 index 00000000000..204aa3da7a1 --- /dev/null +++ b/quest/m1/auth/violations.md @@ -0,0 +1,45 @@ +# [M] 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, 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. 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. +- 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. +- 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. +- 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 +`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