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
2 changes: 2 additions & 0 deletions quest/m1/auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions quest/m1/auth/js-fetch-watch.md
Original file line number Diff line number Diff line change
@@ -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.
45 changes: 45 additions & 0 deletions quest/m1/auth/violations.md
Original file line number Diff line number Diff line change
@@ -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.
Comment on lines +19 to +21

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cover malformed inbound AUTH messages

The exhaustive goal still omits failures while decoding the presenter's initial AUTH. For example, a lite AUTH with an invalid message or token length reaches AuthServe::poll_serve; Rust's Control::poll only logs the returned decode error in rs/moq-net/src/lite/publisher.rs, and JS's #runBidis catch only resets the stream in js/net/src/lite/connection.ts, despite the lite draft's Message Length rule calling for PROTOCOL_VIOLATION. Since this decode case and the requested regressions are limited to AUTH_OK/AUTH_ERROR, completing the quest still leaves a peer able to repeat malformed AUTH streams without closing the session, so include acceptor-side AUTH decoding in the scope and tests.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. 8b26a0e adds the acceptor-side case: a presenter AUTH that fails to decode only aborts its stream in Rust lite AuthServe and JS #runBidis, so it is now a fourth gap in scope, with the same one-regression-per-case bar.

(Written by Claude Opus 5.5)

Comment on lines +19 to +21

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject unexpected AUTH reply types

When an acceptor replies with a message type other than AUTH_OK or AUTH_ERROR, this never enters either decoder covered here: Rust lite returns DecodeError::InvalidMessage in lite/auth.rs:183-189, Rust IETF returns Error::UnexpectedMessage in ietf/auth.rs:324-362, and both JS wires throw from their type switches before decoding a reply body. Those paths currently end only the token, even though the IETF draft identifies unknown message types as session-fatal. Include type-dispatch failures and their regressions explicitly so the quest cannot complete while leaving this case unchanged.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. 5af6279 adds unknown AUTH reply types to the list.

(Written by Claude Opus 5.5)

- 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.
Comment on lines +25 to +27

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Detect a second AUTH on the same request stream

This is separate from reusing the first Request ID on another request: an IETF presenter can send a valid AUTH and then append a second AUTH on the same open stream. Rust Serve::run moves to serve_issue, which polls only reader.closed, and JS AuthSession.serve likewise waits only for IssuedGrant.closed, so neither implementation parses or rejects the repeated request. The existing PUBLISH_NAMESPACE handlers explicitly classify the analogous repeated initial message as a duplicate request and a protocol violation (ietf/subscriber.rs:1059-1069 and ietf/subscriber.ts:914-928); add this AUTH case and regressions because validating only the initially decoded ID will not catch it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. 5af6279 adds a second AUTH on an open IETF AUTH stream, treated like a repeated PUBLISH_NAMESPACE. Since each push surfaces another path, the plan now says the list comes from review and asks the implementer to audit every AUTH read path on both sides, both protocols, and both languages. It is also resized to [M].

(Written by Claude Opus 5.5)

- 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`.
Comment on lines +37 to +39

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject reused IETF AUTH request IDs

The exhaustive plan still misses an AUTH whose Request ID is reused by another request. The IETF auth draft says this ID is allocated like every other request, and the existing IETF handlers treat a duplicate request ID as a session-fatal protocol violation (rs/moq-net/src/ietf/subscriber.rs:5293-5344), but both AUTH acceptors currently discard the decoded ID (Serve::run in rs/moq-net/src/ietf/auth.rs and IetfAuthWire.accept in js/net/src/ietf/auth.ts). Consequently, completing only the listed cases would still let a Rust or JS peer accept repeated IDs without closing the session; include ID validation and corresponding regressions in this quest.

AGENTS.md reference: AGENTS.md:L16-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. f211e7b adds it: both IETF AUTH acceptors discard the decoded Request ID, so the quest now validates it like every other request, with a duplicate being session-fatal.

(Written by Claude Opus 5.5)


Public API: none. Wire: none beyond draft wording.

## Related

- [AUTH endings](/quest/m1/auth/error-codes.md) - the Rust lite case this generalizes
Loading