Search date-range filter is silently ignored for unencrypted rooms #13

Closed
opened 2026-09-12 01:50:50 -04:00 by jared · 0 comments
Owner

Severity: high · Type: bug · Confidence: high

Location: src/app/features/message-search/useMessageSearch.ts:135-140, src/app/features/message-search/SearchFilters.tsx:536-556, LOTUS_FEATURES.md:745

Problem

The server request adds from_ts / to_ts to the room_events filter with the comment "valid Matrix spec fields not yet in SDK types". They are not spec fields — RoomEventFilter has no timestamp bounds (see IFilterComponent in matrix-js-sdk/lib/filter-component.d.ts), and Synapse drops unknown filter keys. The server therefore returns results from outside the selected range, and nothing post-filters them client-side (applyResultFilters only handles msgtype + pinned). Only the local/encrypted path (useLocalMessageSearch's inRange) actually honours the range, so the same query gives a correctly-filtered encrypted section next to an unfiltered plaintext section.

How to trigger

Search a term that occurs in a plaintext room, set a date range that excludes those hits — they still appear.

Suggested fix

Drop from_ts/to_ts from the request and post-filter server results by event.origin_server_ts in applyResultFilters (same predicate the local search already uses), so the filter is consistent across both sections.


Filed from the September 2026 client audit (branch lotus @ 4bea4895).

**Severity:** high · **Type:** bug · **Confidence:** high **Location:** `src/app/features/message-search/useMessageSearch.ts:135-140`, `src/app/features/message-search/SearchFilters.tsx:536-556`, `LOTUS_FEATURES.md:745` ### Problem The server request adds `from_ts` / `to_ts` to the `room_events` filter with the comment "valid Matrix spec fields not yet in SDK types". They are not spec fields — `RoomEventFilter` has no timestamp bounds (see `IFilterComponent` in `matrix-js-sdk/lib/filter-component.d.ts`), and Synapse drops unknown filter keys. The server therefore returns results from outside the selected range, and nothing post-filters them client-side (`applyResultFilters` only handles msgtype + pinned). Only the local/encrypted path (`useLocalMessageSearch`'s `inRange`) actually honours the range, so the same query gives a correctly-filtered encrypted section next to an unfiltered plaintext section. ### How to trigger Search a term that occurs in a plaintext room, set a date range that excludes those hits — they still appear. ### Suggested fix Drop `from_ts`/`to_ts` from the request and post-filter server results by `event.origin_server_ts` in `applyResultFilters` (same predicate the local search already uses), so the filter is consistent across both sections. --- _Filed from the September 2026 client audit (branch `lotus` @ 4bea4895)._
jared added this to the Audit 2026-09 · High milestone 2026-09-12 01:50:50 -04:00
jared added the bugpriority: higharea: messaging labels 2026-09-12 01:50:50 -04:00
jared self-assigned this 2026-09-12 01:50:50 -04:00
jared closed this issue 2026-09-12 14:59:49 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
2026-10-14
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#13