Skip to content

Community room sessions end with the person's session - #536

Merged
andersalm merged 3 commits into
developfrom
fix/room-session-bound
Nov 5, 2026
Merged

andersalm merged 3 commits into
developfrom
fix/room-session-bound

Conversation

@andersalm

Copy link
Copy Markdown
Contributor

Deepen notes

  1. Expert view: bind every room-session use to the person's live grant instead of trusting the cookie's own 12-hour expiry, and fail closed on records that predate the binding.
  2. Raw material: develop 22a5151: room_service.rs SESSION_TTL_SECS and the session validators, gateway_room.rs session start and every room route, auth.rs load_active_session_grant.
  3. Methods: trace each of the eleven room-session use paths to a validator; real HTTP handler tests; clamp at mint and check on use.
  4. Independent check: new regressions fail on develop and pass here; Claude review (Cursor) PASS on 51a5ba3 with all eleven paths traced and Chat reconnect tests run (13/13); full Linux remote check PASS on a943147.

Problem

A Community room session was minted for 12 hours and checked only against its own expiry, so after sign-out or a revoked sign-in it kept working until it expired. Found in an independent security review of #532.

Change

  • A room session expires no later than the frame token that authorised it and the person's grant, on start and on every renewal through /session/start.
  • Every room-session use (start, leave, poll, send, uploads, attachments, views) requires the matching grant to be active; sign-out or revocation takes effect on the next request.
  • Tokens tied to a person's grant (Home launch and projection tokens, passkey step-up, shared-content checks) are minted no later than the grant's expiry. Guest, Community-node and CLI device authority are unchanged.
  • A stored room session without a recorded authority is refused (Chat starts a new one by itself); a grant that lapses mid-request returns 401, not 500.

Tests

10 new room and token regressions (6 failed before, a normal 12-hour session still lasts 12 hours); legacy record refusal and lapsed-grant 401; room tests 157, home-token 20, Chat online 13, behaviour suite 2,180, full Linux check PASS.

@andersalm
andersalm requested a review from irzhywau November 5, 2026 16:39
@andersalm

Copy link
Copy Markdown
Contributor Author

Bounded SOURCE PASS for the reviewed candidate. I traced room-session creation, renewal and the eleven use paths through grant/principal binding, expiry and both validators, including legacy-record refusal. The shared token-expiry changes retain the recovery path that prepares tokens before committing the grant.
The candidate diff check passes. Root read the exact-head/tree/base full Linux PASS receipt and inspected the HTTP, revocation/sign-out, replacement-grant, legacy and expiry regressions; compiled test execution and totals remain owner evidence. Root ran no build or installed session.
Main retains current checks, required reviews and integration. The installed sign-out/reconnect and long-session journeys remain with #86/#535; this verdict grants source scope only.

@andersalm andersalm mentioned this pull request Nov 5, 2026
5 of 6 tasks
@andersalm
andersalm merged commit 344284e into develop Nov 5, 2026
16 checks passed
@andersalm

Copy link
Copy Markdown
Contributor Author

Merged into develop for the 2.0.1 build after Root's bounded source pass, the Claude review and CI 15/15. @irzhywau your review is still wanted: it is a gate before 2.0.1 is signed (release issue #535), not before this merge.

@irzhywau

irzhywau commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

okey, I will take a look

@irzhywau

irzhywau commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Independent security review — PR #536 (Community room sessions end with the person's session)

Two-model independent review (DeepSeek + Claude Opus 5.5), each finding re-checked against the merged tree 344284ebb. Covers the security fix for the room-session lifetime finding (S5) and the conditional mint clamp (S6) from the #532 review.

Verdict: PASS. Both findings are closed; no new issue was introduced.

Confirmed closures

  • S5 — room session bound to the live grant. RoomSessionAuthorization stores the person's grant identity on the session record; every room-session use (start, leave, poll, send, uploads, attachments, views) re-loads and validates the live grant through validate_session/validate_session_for_read. Sign-out or revocation now takes effect on the next request, not after 12 hours. Session expiry is clamped to min(12 h, frame token exp, grant exp).
  • S6 — unconditional mint clamp. grant_bound_token_expiry clamps every proof-bound mint (Home token, direct contexts, projections, passkey step-up, shared-content checks) to the grant's expiry; exp is signed, so it cannot be altered afterward.
  • Legacy stored sessions without a recorded authority are refused (fail-closed), and a lapsed grant mid-request returns 401, not 500.

Items raised in cross-check, resolved against the tree

  • Route coverage — verified no room-access path bypasses the validator: all 13 access operations go through validate_session/validate_session_for_read; no direct token lookup exists outside them.
  • Proofless authority — the proofless branch only ever holds device-identity (CLI) principals, never a person grant; a person proofless token is unmintable, so this stays operator-only and pre-documented.
  • Recovery mint (Some(grant.expires_at), no liveness check) — safe: expiry derives from the grant, and every consumer re-validates liveness at use.

Follow-ups (post-merge, non-blocking)

Neither follow-up is exploitable; both fail closed.

@irzhywau

irzhywau commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

@andersalm both issues have already 1 PR each related to them.
Only the advisory left without PR for now

@andersalm

Copy link
Copy Markdown
Contributor Author

@irzhywau gentle reminder: your review of this change (room sessions end with the person's session, your S5/S6 finding) is a gate before 2.0.1 stable, planned for this weekend. 2.0.1-rc.1 is about to go to the test channel with it; if you find anything, it can still go into the stable build.

@andersalm

Copy link
Copy Markdown
Contributor Author

Correction to my reminder above: @irzhywau's independent security review already passed this change on 5 Nov (comment 6665818315, on the merged tree 344284e). The seven files it reviewed are byte-identical in the 2.0.1-rc.1 source (30b166b), so that PASS carries to the release candidate. Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants