diff options
author | Erik Johnston <erik@matrix.org> | 2019-01-29 22:58:38 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-01-29 22:58:38 +0000 |
commit | 67b82f133631879244773421988d52b1eb626d78 (patch) | |
tree | b62b1658804c8f76cde6f5a9d24e7aff3af56438 /synapse/event_auth.py | |
parent | Fixup comment (diff) | |
parent | Merge pull request #4514 from matrix-org/erikj/remove_event_id (diff) | |
download | synapse-67b82f133631879244773421988d52b1eb626d78.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/redactions_eiah
Diffstat (limited to 'synapse/event_auth.py')
-rw-r--r-- | synapse/event_auth.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/synapse/event_auth.py b/synapse/event_auth.py index df30c2cea7..8f9e330da5 100644 --- a/synapse/event_auth.py +++ b/synapse/event_auth.py @@ -22,6 +22,7 @@ from unpaddedbase64 import decode_base64 from synapse.api.constants import ( KNOWN_ROOM_VERSIONS, + EventFormatVersions, EventTypes, JoinRules, Membership, @@ -55,7 +56,6 @@ def check(room_version, event, auth_events, do_sig_check=True, do_size_check=Tru if do_sig_check: sender_domain = get_domain_from_id(event.sender) - event_id_domain = get_domain_from_id(event.event_id) is_invite_via_3pid = ( event.type == EventTypes.Member @@ -72,9 +72,13 @@ def check(room_version, event, auth_events, do_sig_check=True, do_size_check=Tru if not is_invite_via_3pid: raise AuthError(403, "Event not signed by sender's server") - # Check the event_id's domain has signed the event - if not event.signatures.get(event_id_domain): - raise AuthError(403, "Event not signed by sending server") + if event.format_version in (EventFormatVersions.V1,): + # Only older room versions have event IDs to check. + event_id_domain = get_domain_from_id(event.event_id) + + # Check the origin domain has signed the event + if not event.signatures.get(event_id_domain): + raise AuthError(403, "Event not signed by sending server") if auth_events is None: # Oh, we don't know what the state of the room was, so we |