-
-
Notifications
You must be signed in to change notification settings - Fork 248
feat(net): reset revoked lite streams with UNAUTHORIZED #4179
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
b4a6a41
179de87
1121b30
11c8847
81842e7
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 |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ import { type Dispose, type Getter, race, Signal } from "@moq/signals"; | |
| import type { Grant } from "../auth.ts"; | ||
| import { enforceGrant } from "../auth_session.ts"; | ||
| import type * as broadcast from "../broadcast.ts"; | ||
| import { error, NotFound, reason, SessionCode, SessionError, StreamCode, StreamError } from "../error.ts"; | ||
| import { error, NotFound, reason, StreamCode, StreamError, unauthorized } from "../error.ts"; | ||
| import type * as group from "../group.ts"; | ||
| import { type Hop, type Route, routesEqual } from "../hop.ts"; | ||
| import { hiddenBelow, hooks } from "../internal.ts"; | ||
|
|
@@ -587,7 +587,7 @@ export class Publisher { | |
| // Checked before resolving, so a denied request never reaches the origin. | ||
| const denied = () => this.#denied(msg.broadcast); | ||
| if (denied()) { | ||
| stream.writer.reset(new SessionError(SessionCode.Unauthorized, { reason: msg.broadcast })); | ||
| stream.writer.reset(unauthorized(msg.broadcast)); | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -624,7 +624,7 @@ export class Publisher { | |
| let datagrams = Promise.resolve(); | ||
| let controls: SubscriptionControls | undefined; | ||
|
|
||
| const revoked = new SessionError(SessionCode.Unauthorized, { reason: msg.broadcast }); | ||
| const revoked = unauthorized(msg.broadcast); | ||
| const disposeGrant = this.#grant?.subscribe(() => { | ||
|
Comment on lines
+627
to
628
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.
If the grant shrinks while Useful? React with 👍 / 👎. |
||
| if (!denied()) return; | ||
| console.debug(`publish revoked: broadcast=${msg.broadcast} track=${track.name}`); | ||
|
|
@@ -721,7 +721,7 @@ export class Publisher { | |
| return; | ||
| } | ||
| if (this.#denied(msg.broadcast)) { | ||
| stream.writer.reset(new SessionError(SessionCode.Unauthorized, { reason: msg.broadcast })); | ||
| stream.writer.reset(unauthorized(msg.broadcast)); | ||
|
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 the grant shrinks after this entry check, an in-flight fetch continues through Useful? React with 👍 / 👎. |
||
| return; | ||
| } | ||
|
|
||
|
|
@@ -946,7 +946,7 @@ export class Publisher { | |
| */ | ||
| async runTrackInfo(msg: TrackMessage, stream: Stream) { | ||
| if (this.#denied(msg.broadcast)) { | ||
| stream.writer.reset(new SessionError(SessionCode.Unauthorized, { reason: msg.broadcast })); | ||
| stream.writer.reset(unauthorized(msg.broadcast)); | ||
| return; | ||
| } | ||
| try { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,10 +10,9 @@ import { | |
| error, | ||
| ProtocolViolation, | ||
| reason, | ||
| SessionCode, | ||
| SessionError, | ||
| StreamCode, | ||
| StreamError, | ||
| unauthorized, | ||
| } from "../error.ts"; | ||
| import * as netGroup from "../group.ts"; | ||
| import { Cost, type Hop, MAX_HOPS, type Route, routesEqual, UNKNOWN_HOP } from "../hop.ts"; | ||
|
|
@@ -527,9 +526,9 @@ export class Subscriber { | |
| request.reject(new Error(EMPTY_RANGE)); | ||
| return; | ||
| } | ||
| const unauthorized = new SessionError(SessionCode.Unauthorized, { reason: broadcast }); | ||
| const refused = unauthorized(broadcast); | ||
| if (this.#denied(broadcast)) { | ||
| request.reject(unauthorized); | ||
| request.reject(refused); | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -586,8 +585,8 @@ export class Subscriber { | |
| const disposeGrant = this.#grant?.subscribe(() => { | ||
| if (!this.#denied(broadcast)) return; | ||
| console.debug(`subscribe revoked: id=${id} broadcast=${broadcast} track=${request.name}`); | ||
| producer.close(unauthorized); | ||
| stream.abort(unauthorized); | ||
| producer.close(refused); | ||
| stream.abort(refused); | ||
|
Comment on lines
585
to
+589
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.
If the grant shrinks while Useful? React with 👍 / 👎. |
||
| }); | ||
| try { | ||
| // Watch for subscription changes and send SUBSCRIBE_UPDATE. Lite01/Lite02 | ||
|
|
||
This file was deleted.
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.
When this IETF consumer is used as a route and its request is denied or later revoked,
refusednow propagates asStreamCode.Unauthorized; however,ietf/publisher.tsmaps routed demand failures and terminalpublishErrorvalues toINTERNAL_ERROR, recognizing unauthorized only from its own local grant watcher. A JS relay serving the route over another IETF session therefore hides the revocation, unlike the new Rust bridge conversion. Recognize this stream code in both the request-refusal and PUBLISH_DONE mappings. (Written by GPT-5.6 Sol)AGENTS.md reference: AGENTS.md:L97-L97
Useful? React with 👍 / 👎.