test(interop): assert each AUTH cell's grant and refuse a publish outside it - #4181
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…side it Every interop client now dials with a token minted for its cell and verified by `moq auth serve`. The Rust CLI (a new `moq_net::auth` debug log per AUTH_OK) and the native JS subscribers print the grant they received, and the harness fails the cell unless it matches the token. A final round per enforcing publisher (Rust, browser) mints a token that excludes its broadcast: the publisher must fail loud with Unauthorized naming the path, and every subscriber must see nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Grok 4.7 <noreply@x.ai>
435129e to
6bb0e4b
Compare
|
Rebased onto @codex review (Written by Grok 4.7) |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Squash-merged onto After the merge:
(Written by Grok 4.7) |
Problem
The interop matrix ran the relay with
public = "**"and checked media alone. A relay that sent a malformed AUTH_OK, or none, left the client with no grant and every cell still passed. Nothing checked that a publish outside the grant fails loud.Approach
moq auth servewith a key generated per run; nothing is anonymous. Each publisher dials with--publish '<broadcast>/**'and each subscriber with--subscribe '<broadcast>/**', so every client also covers the?jwt=URL.moq_net::authlogs oneauth granted publish=[...] subscribe=[...]debug line per AUTH_OK. The native JS subscriber prints the same line fromconnection.auth.grant. The harness enables the log for moq-cli (RUST_LOG=...,moq_net::auth=debug) and fails a Rust or native JS cell whose last grant is missing or differs from the token, even if media flowed.interop-allowed-<pid>/**only. It passes only if the publisher log names the broadcast on the "publishing outside our grant" line and says Unauthorized, every subscriber times out, and the publisher's printed grant matches its token. The check reads the session close, not a stream code, so it holds whether or not the dedicated UNAUTHORIZED reset lands.--negativeand--mediaget tokens too (media uses one**token).b1.hangtoken reads asauth token ended err=unsupported).bindings.mdatprints_grant/enforces_grant, which is where the binding clients join.Sensitivity check: swapping the relay's grant halves in
lite/session.rsfails every Rust and native JS cell withgrant: got ..., token implies ....Impact
moq-net: a newdebuglog line (moq_net::auth, "auth granted") per AUTH_OK received.test/interop/interop.toml: token auth (auth.url) replaces anonymous access.Alternatives
moq_tokio::Connection::auth()for moq-cli to print the grant. Not done: Relay tokens owns that accessor and plans a different shape.@moq/netConnection. Not done: it deliberately keeps its session private, so the browser cells check media and the refusal only.public = "**"beside the tokens. Rejected: a client that silently dropped its token would still pass.Follow-ups
just test interop --all: every Rust, browser, native JS, C, and GStreamer cell passed, plus both refusal rounds. The Python and Go clients are unavailable because main'smoq-ffifails to compile (E0283, waiting on fix(ffi): name the binary config conversion so moq-ffi compiles #4157).js -> jsfailed once when the canvas intercepted the pause click, then passed on two reruns: a UI flake unrelated to auth.--timeoutper enforcing publisher (about 60s with--all).nix developruns can pick the same port: the harness keeps its port reservations under the per-shellTMPDIR. This predates the PR.(Written by Claude Opus 5.5)
🤖 Generated with Claude Code