Repository navigation
quest(auth): AUTH protocol violations close the session everywhere #4554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c82f9c7
8b26a0e
f211e7b
5af6279
95c01d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. |
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 Useful? React with 👍 / 👎.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 Useful? React with 👍 / 👎.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 ( AGENTS.md reference: AGENTS.md:L16-L18 Useful? React with 👍 / 👎.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 reachesAuthServe::poll_serve; Rust'sControl::pollonly logs the returned decode error inrs/moq-net/src/lite/publisher.rs, and JS's#runBidiscatch only resets the stream injs/net/src/lite/connection.ts, despite the lite draft's Message Length rule calling forPROTOCOL_VIOLATION. Since this decode case and the requested regressions are limited toAUTH_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 👍 / 👎.
There was a problem hiding this comment.
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
AuthServeand 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)