summary refs log tree commit diff
path: root/synapse/event_auth.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-19 18:00:46 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-19 18:00:46 +0000
commit3719f3fa2f3a834e4b12d78afb9f505b37e003f5 (patch)
tree10e69c64d7ac51250a1c56304101489020d00cf6 /synapse/event_auth.py
parentMerge pull request #6537 from matrix-org/erikj/bump_mypy_version (diff)
parentSanity-check room ids in event auth (#6530) (diff)
downloadsynapse-3719f3fa2f3a834e4b12d78afb9f505b37e003f5.tar.xz
Sanity-check room ids in event auth (#6530)
* commit '971a0702b':
  Sanity-check room ids in event auth (#6530)
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 c940b84470..80ec911b3d 100644 --- a/synapse/event_auth.py +++ b/synapse/event_auth.py
@@ -50,6 +50,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)