0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-16 22:33:51 +01:00

Fix error handling for missing auth_event

When we were authorizing an event, if there was no `m.room.create` in its
auth_events, we would raise a SynapseError with a cryptic message, which then
meant that we would bail out of processing any incoming events, rather than
storing a rejection for the faulty event and moving on.

We should treat the absent event the same as any other auth failure, by
raising an AuthError, so that the event is marked as rejected.
This commit is contained in:
Richard van der Hoff 2018-09-25 16:34:40 +01:00
parent bf01efb864
commit 8afddf7afe

View file

@ -98,9 +98,9 @@ def check(event, auth_events, do_sig_check=True, do_size_check=True):
creation_event = auth_events.get((EventTypes.Create, ""), None)
if not creation_event:
raise SynapseError(
raise AuthError(
403,
"Room %r does not exist" % (event.room_id,)
"No create event in auth events",
)
creating_domain = get_domain_from_id(event.room_id)