summary refs log tree commit diff
path: root/synapse/event_auth.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-12-17 10:56:36 +0000
committerRichard van der Hoff <richard@matrix.org>2019-12-17 10:56:36 +0000
commit2eda49a8db66e2588a64c73b4642e9a05e3663d5 (patch)
tree85e7e19f266d3dfbdc2836aaa4f263f4c1c8bdeb /synapse/event_auth.py
parentMerge remote-tracking branch 'origin/release-v1.7.0' into matrix-org-hotfixes (diff)
parentAdd auth events as per spec. (#6556) (diff)
downloadsynapse-2eda49a8db66e2588a64c73b4642e9a05e3663d5.tar.xz
Merge remote-tracking branch 'origin/release-v1.7.1' into matrix-org-hotfixes
Diffstat (limited to 'synapse/event_auth.py')
-rw-r--r--synapse/event_auth.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/event_auth.py b/synapse/event_auth.py

index ec3243b27b..d184b0273b 100644 --- a/synapse/event_auth.py +++ b/synapse/event_auth.py
@@ -48,6 +48,18 @@ def check(room_version, event, auth_events, do_sig_check=True, do_size_check=Tru if not hasattr(event, "room_id"): raise AuthError(500, "Event has no room_id: %s" % event) + room_id = event.room_id + + # I'm not really expecting to get auth events in the wrong room, but let's + # sanity-check it + for auth_event in auth_events.values(): + if auth_event.room_id != room_id: + raise Exception( + "During auth for event %s in room %s, found event %s in the state " + "which is in room %s" + % (event.event_id, room_id, auth_event.event_id, auth_event.room_id) + ) + if do_sig_check: sender_domain = get_domain_from_id(event.sender)