summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-05-14 10:07:54 +0100
committerGitHub <noreply@github.com>2020-05-14 10:07:54 +0100
commita0e063387d5c8390b19cf69359a90924ecd4fbda (patch)
treeb93d624d3be4e2eceb40c95e4354130c639b182b /synapse
parentDo not validate that the client dict is stable during UI Auth. (#7483) (diff)
downloadsynapse-a0e063387d5c8390b19cf69359a90924ecd4fbda.tar.xz
Stop `get_joined_users` corruption from custom statuses (#7376)
Fix a bug where the `get_joined_users` cache could be corrupted by custom
status events (or other state events with a state_key matching the user ID).

The bug was introduced by #2229, but has largely gone unnoticed since then.

Fixes #7099, #7373.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/data_stores/main/roommember.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/storage/data_stores/main/roommember.py b/synapse/storage/data_stores/main/roommember.py
index d5bd0cb5cf..e626b7f6f7 100644
--- a/synapse/storage/data_stores/main/roommember.py
+++ b/synapse/storage/data_stores/main/roommember.py
@@ -576,7 +576,8 @@ class RoomMemberWorkerStore(EventsWorkerStore):
                         if key[0] == EventTypes.Member
                     ]
                     for etype, state_key in context.delta_ids:
-                        users_in_room.pop(state_key, None)
+                        if etype == EventTypes.Member:
+                            users_in_room.pop(state_key, None)
 
         # We check if we have any of the member event ids in the event cache
         # before we ask the DB