diff options
author | Shay <hillerys@element.io> | 2024-03-19 10:52:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-19 17:52:53 +0000 |
commit | 8fb5b0f335b3dc54962aea102c71a7e449497487 (patch) | |
tree | 698b5e92f822198a51131108a15fe61ac1501358 /synapse/handlers/sync.py | |
parent | Bump pydantic from 2.6.0 to 2.6.4 (#17004) (diff) | |
download | synapse-8fb5b0f335b3dc54962aea102c71a7e449497487.tar.xz |
Improve event validation (#16908)
As the title states.
Diffstat (limited to 'synapse/handlers/sync.py')
-rw-r--r-- | synapse/handlers/sync.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 0aedb37f16..3aa2e2b7ba 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -41,6 +41,7 @@ from synapse.api.constants import ( AccountDataTypes, EventContentFields, EventTypes, + JoinRules, Membership, ) from synapse.api.filtering import FilterCollection @@ -675,13 +676,22 @@ class SyncHandler: ) ) - loaded_recents = await filter_events_for_client( + filtered_recents = await filter_events_for_client( self._storage_controllers, sync_config.user.to_string(), loaded_recents, always_include_ids=current_state_ids, ) + loaded_recents = [] + for event in filtered_recents: + if event.type == EventTypes.CallInvite: + room_info = await self.store.get_room_with_stats(event.room_id) + assert room_info is not None + if room_info.join_rules == JoinRules.PUBLIC: + continue + loaded_recents.append(event) + log_kv({"loaded_recents_after_client_filtering": len(loaded_recents)}) loaded_recents.extend(recents) |