mirror of
https://github.com/element-hq/synapse.git
synced 2026-09-21 07:26:19 +00:00
## The bug With the experimental [MSC4222](https://github.com/matrix-org/matrix-spec-proposals/pull/4222) implementation enabled (`use_state_after`) and lazy-loading of room members, an incremental `/sync` could disclose state from **after** the user's leave in a left room's `state_after`. 1. Alice syncs with `lazy_load_members: true` and `use_state_after=true`. 2. Bob sends a message in a room they share. 3. Alice leaves the room. 4. Bob updates his per-room displayname 5. Alice does an incremental sync covering steps 2–3. Alice's `state_after` contains Bob's post-leave membership event from step 4 Alice should not see the new per-room display name of Bob. ## The fix Copy what has been done for `_compute_state_delta_for_full_sync`: pass `joined` down and, for rooms the user is no longer joined to, fetch the memberships as of `end_token` via state groups (`get_state_ids_at`) instead of current state.