Skip to content

moq-net auth: expiry vs deny codes, renewal on session-authorized requests, tokenless PUBLISH_NAMESPACE, kind/path on auth::Request #7646

Closed

Description

@ksletmoe-aws

Four notes on moq-net's auth path, from a relay on main (e072cf6) that verifies tokens itself. Three line up with quest/m1/ietf-token-auth.md; one is new. None is urgent. Happy to carry PRs for any you'd take.

1. Distinguish token expiry from deny on the wire (new).
When a request-token grant lapses, the subscription ends with PUBLISH_DONE status UNAUTHORIZED, reason "token expired" (ietf/publisher.rs Served::status, which notes PUBLISH_DONE has no token-expiry status), group streams reset INTERNAL_ERROR, and an announce just has its request stream finish. A client can't tell "renew and retry" from "denied" without parsing the reason string. Candidates: a stream reset with EXPIRED_AUTH_TOKEN (0x07) for a lapsed subscription, 0x05 for an expired request token, or a dedicated PUBLISH_DONE status (its own EXPIRED means the subscription's lifetime ended, which is presumably why it's avoided). Related: at the request level an acceptor fault also collapses to UNAUTHORIZED 0x1, so "retry" and "denied" look the same there too. I didn't find a quest for this.

2. Confirming a reading of ietf-token-auth: "a REQUEST_UPDATE carrying a new token moves the request to that token's auth."
Does that include a request admitted without a token (session-authorized)? Today apply_subscription_update refuses "AUTHORIZATION TOKEN on a request admitted without one" and ends the subscription. If the quest lets such a request move to T's auth, a client with a session-level credential can renew on any live request; if not, it has to put a token on every request so each is a renewal carrier. Either is workable (and with one verification per distinct T, identical token bytes across requests cost one verify), I'd just like to build to the intended one.

3. Also from that quest: "a request without T is refused where only T covers it."
Today a tokenless PUBLISH_NAMESPACE outside the limit gets PUBLISH_NAMESPACE_OK and is held (ietf/subscriber.rs attach, "held, not refused"), so a publisher that forgot its token sees success and publishes into nothing. Reading the quest as fixing that with an UNAUTHORIZED refusal; shout if the hold is deliberate.

4. Expose the request kind and path on auth::Request.
RequestKind exists but is pub(crate), and Request exposes token() only. An acceptor that authorizes per resource can't make one decision for the request made and has to pre-evaluate every path the principal might reach, returning exact grant patterns. Public kind + path on Request would let it authorize exactly what was asked. Small, and it fits the quest's "any request type may carry a token".

If any of this contradicts a decision I've missed, a pointer is enough.

(Written with AI assistance.)

Activity

  1. coderabbitai commented on Nov 3, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #7211 - feat(auth)!: share request-token grants and end attachment leases [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    questBeing tracked/planned in a quest. See `quest/`
    on Nov 3, 2026
  3. kixelated commented on Nov 3, 2026

    @kixelated
    Collaborator

    Thanks for these four notes. Decisions:

    1. Expiry vs deny: when a request token's grant lapses, its group streams will reset with the draft's EXPIRED_AUTH_TOKEN code instead of INTERNAL_ERROR. PUBLISH_DONE stays UNAUTHORIZED, since its own EXPIRED means the subscription's lifetime ran out. This is planned in quest: import #7573, #7579, #7646 and settle time-addressing's timestamps #7665 as quest/m1/auth-expiry-reset.md; run /quest-start quest/m1/auth-expiry-reset to pick it up.
    2. Session-authorized requests: these stay refused, as today. A request is admitted either by the session or by a token, and that never changes, so a client that wants to renew per request puts a token on it from the start.
    3. Tokenless PUBLISH_NAMESPACE outside the limit: the hold goes away, and it is refused with UNAUTHORIZED. A publisher whose limit later widens re-announces.
    4. auth::Request kind and path: RequestKind becomes public, and Request gains kind() and path().

    Points 2 to 4 are being folded into #7211, the ietf-token-auth implementation. You're welcome to carry PRs, and to run /quest-start with the branch above if you'd like to donate tokens.

    (Written by Claude Opus 5.5)

  4. added a commit that references this issue on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questBeing tracked/planned in a quest. See `quest/`

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions