Replying from a browser notification doesn't re-check room encryption at send time, and posts with the newest session rather than the notification's account #299

Closed
opened 2026-10-04 21:09:04 -04:00 by jared · 0 comments
Owner

The inline Reply action on browser notifications (#203) is posted by the service worker as a plain m.room.message (src/swReply.ts, sendNotificationReply), because a service worker can't encrypt.

ClientNonUIFeatures correctly leaves the action out for encrypted rooms (src/app/pages/client/ClientNonUIFeatures.tsx:557-566), but only at the moment the notification is shown. Two gaps:

  1. Encryption turned on later. Notifications stay in the OS notification centre for hours. If the room enables encryption in the meantime, a reply typed later is still sent in the clear into what is now an encrypted room. sw.ts:153-175 checks nothing at send time.
  2. Wrong account. The worker posts with Array.from(sessions.values()).pop(), the newest session it has seen, not the account the notification belongs to. After logging out and into another account, replying to an old notification posts as the new account (or fails).

Fix

  • Before sending, GET /rooms/{roomId}/state/m.room.encryption/ with the session token; if it exists, refuse and show "Open the app to reply in this encrypted room".
  • Store the user id in the notification's data and pick the matching session (or refuse when it no longer exists).

Introduced by d4420905 (2026-09-19, #203).


Found in the October 2026 client audit (Playwright against a local Synapse + LiveKit stack, plus code reading). Code refs are at cinny 30e2dbcd, cinny-desktop 8f67ec7, element-call 3b0050e8.

The inline **Reply** action on browser notifications (#203) is posted by the service worker as a **plain** `m.room.message` (src/swReply.ts, `sendNotificationReply`), because a service worker can't encrypt. `ClientNonUIFeatures` correctly leaves the action out for encrypted rooms (src/app/pages/client/ClientNonUIFeatures.tsx:557-566), but **only at the moment the notification is shown**. Two gaps: 1. **Encryption turned on later.** Notifications stay in the OS notification centre for hours. If the room enables encryption in the meantime, a reply typed later is still sent in the clear into what is now an encrypted room. `sw.ts:153-175` checks nothing at send time. 2. **Wrong account.** The worker posts with `Array.from(sessions.values()).pop()`, the newest session it has seen, not the account the notification belongs to. After logging out and into another account, replying to an old notification posts as the new account (or fails). **Fix** - Before sending, `GET /rooms/{roomId}/state/m.room.encryption/` with the session token; if it exists, refuse and show "Open the app to reply in this encrypted room". - Store the user id in the notification's `data` and pick the matching session (or refuse when it no longer exists). **Introduced by** d4420905 (2026-09-19, #203). --- _Found in the October 2026 client audit (Playwright against a local Synapse + LiveKit stack, plus code reading). Code refs are at cinny `30e2dbcd`, cinny-desktop `8f67ec7`, element-call `3b0050e8`._
jared added the priority: lowsecurityarea: notifications labels 2026-10-04 21:09:04 -04:00
jared closed this issue 2026-10-18 03:55:02 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#299