The persistent encrypted-search opt-in survives logout, so the next account on the device starts with plaintext indexing switched on #296

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

What happens
The opt-in for the persistent encrypted-search index (P4-8) is a single device-wide localStorage flag, searchCacheEnabled (src/app/state/searchCacheEnabled.ts). Logout correctly deletes the index itself (lotus-search-cache IndexedDB is gone), but the flag stays true.

When someone else signs in on that device (a shared or family computer), their encrypted messages are written to disk as decrypted plaintext from their first search, even though they never opted in. The code comments call this "must be explicitly opted into".

Verified (Playwright): signed in, enabled the index, searched, logged out. What remained in localStorage:

after_login_redirect_url, i18nextLng, mxjssdk_memory_filter_FILTER_SYNC_@aud_main:localhost,
pwa-install-visits, searchCacheEnabled, settings-sync-meta:@aud_main:localhost

IndexedDB was empty apart from the SDK's support probe. Drafts, outbox, status, crypto store and the index were all correctly gone. Only the opt-in flag carries over.

Introduced by 7da960ac (2026-07-01, P4-8).

Fix: clear searchCacheEnabled in clearPlaintextCaches (or key it by user id like settings-sync-meta:<user>). While there, settings-sync-meta:<user> and the SDK filter key also leave the previous user's MXID on the device; harmless, but worth sweeping.

Acceptance criteria: after logout, localStorage.getItem('searchCacheEnabled') is null, and a new login starts with the index off.


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.

**What happens** The opt-in for the persistent encrypted-search index (P4-8) is a single device-wide localStorage flag, `searchCacheEnabled` (src/app/state/searchCacheEnabled.ts). Logout correctly deletes the index itself (`lotus-search-cache` IndexedDB is gone), but **the flag stays `true`**. When someone else signs in on that device (a shared or family computer), their encrypted messages are written to disk as **decrypted plaintext** from their first search, even though they never opted in. The code comments call this "must be explicitly opted into". **Verified** (Playwright): signed in, enabled the index, searched, logged out. What remained in localStorage: ``` after_login_redirect_url, i18nextLng, mxjssdk_memory_filter_FILTER_SYNC_@aud_main:localhost, pwa-install-visits, searchCacheEnabled, settings-sync-meta:@aud_main:localhost ``` IndexedDB was empty apart from the SDK's support probe. Drafts, outbox, status, crypto store and the index were all correctly gone. Only the opt-in flag carries over. **Introduced by** 7da960ac (2026-07-01, P4-8). **Fix:** clear `searchCacheEnabled` in `clearPlaintextCaches` (or key it by user id like `settings-sync-meta:<user>`). While there, `settings-sync-meta:<user>` and the SDK filter key also leave the previous user's MXID on the device; harmless, but worth sweeping. **Acceptance criteria:** after logout, `localStorage.getItem('searchCacheEnabled')` is null, and a new login starts with the index off. --- _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: mediumsecurityarea: auth-session labels 2026-10-04 21:03:51 -04:00
jared closed this issue 2026-10-17 17:51:34 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#296