mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:46:01 -04:00
Split event_auth.check
into two parts (#10940)
Broadly, the existing `event_auth.check` function has two parts: * a validation section: checks that the event isn't too big, that it has the rught signatures, etc. This bit is independent of the rest of the state in the room, and so need only be done once for each event. * an auth section: ensures that the event is allowed, given the rest of the state in the room. This gets done multiple times, against various sets of room state, because it forms part of the state res algorithm. Currently, this is implemented with `do_sig_check` and `do_size_check` parameters, but I think that makes everything hard to follow. Instead, we split the function in two and call each part separately where it is needed.
This commit is contained in:
parent
a19aa8b162
commit
428174f902
10 changed files with 177 additions and 172 deletions
|
@ -52,6 +52,7 @@ from synapse.api.errors import (
|
|||
)
|
||||
from synapse.api.filtering import Filter
|
||||
from synapse.api.room_versions import KNOWN_ROOM_VERSIONS, RoomVersion
|
||||
from synapse.event_auth import validate_event_for_room_version
|
||||
from synapse.events import EventBase
|
||||
from synapse.events.utils import copy_power_levels_contents
|
||||
from synapse.rest.admin._base import assert_user_is_admin
|
||||
|
@ -238,8 +239,9 @@ class RoomCreationHandler(BaseHandler):
|
|||
},
|
||||
)
|
||||
old_room_version = await self.store.get_room_version(old_room_id)
|
||||
await self._event_auth_handler.check_from_context(
|
||||
old_room_version.identifier, tombstone_event, tombstone_context
|
||||
validate_event_for_room_version(old_room_version, tombstone_event)
|
||||
await self._event_auth_handler.check_auth_rules_from_context(
|
||||
old_room_version, tombstone_event, tombstone_context
|
||||
)
|
||||
|
||||
await self.clone_existing_room(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue