Repository navigation
fix(net): gate incoming requests at dispatch - #5782
Conversation
|
Implementation and review fixes are complete at
The PR remains draft and unmerged. Recommended next step: review after GitHub checks finish. (written by GPT-6) |
0039c7e to
659d591
Compare
|
Rebased onto main at Keeping this draft: two behavior changes here conflict with settled decisions and need the maintainer.
Recommendation: restore the ceiling (1) and keep the dispatcher-owned gate structure; (2) is a defensible fix but belongs in its own PR with the API impact stated. (Written by Claude Opus 5.5) |
Dispatch builds each incoming request's gate and hands it to the handler, in Rust and JS. Locally issued JS grants are enforced, including renewal, revocation, and expiry. Joining FETCH ends with its parent subscription. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
659d591 to
0c9306c
Compare
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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>
Problem
Each incoming request handler built its own
auth::Gate, or checked the grant inline, so a new request type could be served without one. Per-handler checks already missed several request types (fixed in #4039).Approach
The dispatcher builds every incoming request's gate and hands it to the handler, in Rust and JS. The handler keeps its graceful refusal (PUBLISH_DONE
Unauthorized, REQUEST_ERROR, or a stream reset after FETCH_OK).Gate::named(). Standalone FETCH and TRACK_STATUS hold the gate while the broadcast resolves (Gate::guard).Gate(js/net/src/auth_gate.ts) replaces the per-publisher#denied/#watchhelpers in the lite and IETF publishers.Authorization semantics are as on main: an unnamed request is held to our issued scope and the peer's AUTH_OK grant; a named request to its own grant and the peer's grant.
Decisions
a_request_token_cannot_exceed_the_peers_grantanda_revoked_grant_cancels_its_subscriptionsas on main.requests()withoutauthorize(). A session never authorized stays bound only by its origin handles (an_unauthorized_session_has_no_scoperestored).authorize(), so enforcing issued grants as the incoming scope there is the same change. The earlier revision's JS scope, issued-grant expiry timers, and subscriber-side scope checks are dropped, and JS keeps main's semantics.Separate proposal (no PR opened)
Enforce issued AUTH grants as the incoming scope even without a connection grant: in Rust when an application takes
requests()but never callsauthorize(), and in JS, which has noauthorize(). Today those grants are told to the peer but bound nothing. It changes publicrequests()behavior in both languages, so it needs its own decision.Impact
No public API or wire change. Rust items are
pub(crate)and the JSGateis@internal. Behavior changes: an unnamed joining FETCH ends with its subscription, and standalone FETCH and TRACK_STATUS refuse a grant that narrows while the broadcast resolves.Validation
cargo test -p moq-netandjs/netbun testpass.just check: passed on0c9306c3f.just test interop --all: all checks passed on0c9306c3f.quest checkpasses; the completedquest/m1/auth/request-gate.mdand its references are removed.(Written by Claude Opus 5.5)
🤖 Generated with Claude Code