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
7 changes: 6 additions & 1 deletion doc/bin/relay/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,12 @@ independently of the session's scope. Discovery reveals only paths it grants;
a `PUBLISH_NAMESPACE` grant must cover the whole namespace: `room/**`, not just
`room`. The last naming request ending releases the lease at the auth server;
a later request verifies the token again. Expiry or revocation ends every
request naming it. A joining `FETCH` still follows its subscription. A session verifies at most
request naming it. Expiry says so, so the client knows to renew the token: a
request not yet answered is refused with `EXPIRED_AUTH_TOKEN`, and an answered
one resets with it. A subscription resets its open group streams, a `FETCH`
its data and request streams, and a `PUBLISH_NAMESPACE` cancels its request
stream both ways. A subscription still reports `PUBLISH_DONE` as `UNAUTHORIZED`.
A revoked token ends them without it. A joining `FETCH` still follows its subscription. A session verifies at most
128 tokens at once, counting
checks still running past the admission timeout. Later tokens wait their turn
rather than being refused. Each HTTP request is admitted on its own, so an
Expand Down
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ per-frame CPU growth since #5926.
- [A smaller, safer API than release](/quest/m1/api-audit/README.md) - every surface added since release has a consumer or is gone, overlapping operations are collapsed, names mirror across Rust, JS, and the bindings, and every break says how to migrate
- [moq-crypto replaces moq-sign and moq-e2ee](/quest/m1/moq-crypto.md) - one Rust crate and one JS package hold signing and end-to-end encryption, sharing moq-net's timestamp check
- [Register moq-dev draft 20 in the interop runner](/quest/m1/ietf-drop/README.md) - land the external registry, notes, and README correction for drafts 18, 20, and 22
- [A lapsed request token resets with EXPIRED_AUTH_TOKEN](/quest/m1/auth-expiry-reset.md) - group streams of a lapsed grant reset with the expiry code, so a client knows to renew
- [moq-quic's API improves on quinn's](/quest/m1/quic-api/README.md) - moq-quic and both QUIC drivers ship one mirrored API: `send::`/`recv::` namespaces, one error per direction, consuming terminal operations, plain configs, no quinn baggage
- [On-demand JavaScript FETCH](/quest/m1/js-fetch-on-demand.md) - browser publishers answer IETF FETCH for evicted or uncached groups through the JS ranges request surface
- [Native rung disable proof](/quest/m1/simulcast-rung-disable.md) - a shaped uplink through moq-ffi proves the top rendition stops and resumes over real BBR3 probing
Expand Down
31 changes: 0 additions & 31 deletions quest/m1/auth-expiry-reset.md

This file was deleted.

4 changes: 4 additions & 0 deletions rs/moq-net/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2599,6 +2599,10 @@ impl Gate {
let mut operation = std::pin::pin!(operation);
kio::wait(|waiter| {
std::task::ready!(self.poll_ready(waiter));
// Ahead of the gate it also closes, so a lapsed token is refused as expired.
if let Poll::Ready(refusal) = self.poll_token_ended(waiter) {
return Poll::Ready(Err(refusal.error));
}
if self.poll_denied(waiter).is_ready() {
return Poll::Ready(Err(Error::Unauthorized));
}
Expand Down
6 changes: 6 additions & 0 deletions rs/moq-net/src/coding/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,12 @@ impl<S: RecvStream, V: StreamCodes> Reader<S, V> {
self.stream.stop(self.version.encode_stream_code(&err.into()));
}

/// Send STOP_SENDING with `code`, for a condition no [`StreamError`] names, which the
/// caller has already looked up in the negotiated protocol's registry.
pub(crate) fn stop(&mut self, code: u32) {
self.stream.stop(code);
}

/// Cast the reader to a different version, used during version negotiation.
pub fn with_version<V2>(self, version: V2) -> Reader<S, V2> {
Reader {
Expand Down
8 changes: 8 additions & 0 deletions rs/moq-net/src/coding/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ impl<S: crate::transport::poll::SendStream, V: StreamCodes> Writer<S, V> {
}
}

/// Reset the stream with `code`, for a condition no [`StreamError`] names, which the
/// caller has already looked up in the negotiated protocol's registry.
pub(crate) fn reset(mut self, code: u32) {
if let Some(mut stream) = self.stream.take() {
stream.reset(code);
}
}

/// Finish the stream and wait for the peer to acknowledge everything written.
///
/// [`Self::finish`] alone is not enough to deliver a final message. A stream that has sent
Expand Down
20 changes: 18 additions & 2 deletions rs/moq-net/src/ietf/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! both assign, but not all of it.

use super::Version;
use crate::{SessionError, StreamError};
use crate::{Error, SessionError, StreamError};

/// An implementation-specific error: the stream died on our side, with no registry entry
/// for why.
Expand All @@ -32,6 +32,22 @@ const GOING_AWAY: u32 = 0x4;
/// The subscription outran the publisher's resource limits.
const TOO_FAR_BEHIND: u32 = 0x5;

/// The authorization token for the request has expired.
///
/// Sent only on the streams of a request whose own request token's grant lapsed (see
/// [`token_expired`]), which no [`StreamError`] names: [`to_stream_code`] never returns it,
/// and [`from_stream_code`] keeps it [`StreamError::Unknown`], so a relay passes an
/// upstream's expiry on as INTERNAL_ERROR rather than telling its own peer that its token
/// lapsed. The same 0x7 in drafts 18, 20, and 22.
pub(crate) const EXPIRED_AUTH_TOKEN: u32 = 0x7;

/// Whether `err`, ending a request's token grant, says the token expired: its deadline
/// passing, or the acceptor revoking it as expired. Only such an end sends
/// [`EXPIRED_AUTH_TOKEN`].
pub(crate) fn token_expired(err: &Error) -> bool {
matches!(err, Error::Expired | Error::Session(SessionError::Expired))
}

/// The track's content could not be parsed.
const MALFORMED_TRACK: u32 = 0x12;

Expand Down Expand Up @@ -63,7 +79,7 @@ pub fn to_stream_code(err: &StreamError) -> u32 {
/// A code the drafts do not assign stays [`StreamError::Unknown`], which surfaces as
/// [`Error::Stream`](crate::Error::Stream): an error, but never one given a meaning it did
/// not carry. That includes the codes this crate has no local counterpart for
/// (UNKNOWN_OBJECT_STATUS, EXCESSIVE_LOAD) and every value a later
/// (UNKNOWN_OBJECT_STATUS, [`EXPIRED_AUTH_TOKEN`], EXCESSIVE_LOAD) and every value a later
/// draft may add.
pub fn from_stream_code(code: u32) -> StreamError {
match code {
Expand Down
Loading
Loading