Skip to content

An open preview stream outlives its session's revocation #798

Closed

Description

@Jacksondr5

A preview tab's stream socket stays open after the session that opened it is revoked. Someone whose level is lowered or removed while they watch a tab keeps receiving its page and can still click and type in it, until the tab closes or they disconnect. People and access AC17 says a lowered level takes effect at once, on open connections too; AC49 says an ended device stays ended.

Why: the RPC socket races its handler against sessions.awaitInvalidation(session.sessionId) (apps/server/src/ws.ts, around line 3264), so a revoked session's /ws closes at once. Access.ts relies on that. Upstream's preview stream handler (apps/server/src/preview/ServerBrowserStream.ts, the /api/preview-stream/ws upgrade) checks the session only when it opens and never watches for invalidation. canOperate is also fixed when the socket opens.

Scope: the gap is upstream's and already applies to every session that can stream, such as a device revoked from Connections settings. #797 (for #796) extends it to Collaborators on a thread or project, who are the people most likely to be demoted while watching.

Fix: race the viewer loop in ServerBrowserStream.ts against awaitInvalidation, as ws.ts does. That is an edit to an upstream-owned file: record it in FORK.md, and offer it upstream, since it fixes the same gap there.

Found in review of #797.

Activity

  1. Jacksondr5 commented on Oct 29, 2026

    @Jacksondr5
    OwnerAuthor

    Reproduced live on #797 at f39f404, twice. A thread Collaborator opened /api/preview-stream/ws from a Node client, then the Owner lowered them to Viewer, which revoked their session. The socket kept streaming frames for over two minutes, took control, and clicked the page: the Owner's view of the page went from 2 clicks to 3. The ordinary web client isn't affected, because its page reloads when the session is renewed and the new session is refused. Only a client that holds the socket open keeps it.

  2. added 2 commits that reference this issue on Oct 31, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions