-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
Since newer versions of events don't have the same format for event ID.
The event ID is changing, so we can no longer get the domain from it. On the other hand, the check is unnecessary.
The transaction queue only sends out events that we generate. This was done by checking domain of event ID, but that can no longer be used. Instead, we may as well use the sender field.
We only process events sent to us from a server if the event ID matches the server, to help guard against federation storms. We replace this with a check against the event origin.
|
In future version events won't have an event ID, so we won't be able to do this check.
ecd6c6b
to
b40abe0
Compare
Fixed now |
Codecov Report
@@ Coverage Diff @@
## develop #4514 +/- ##
===========================================
+ Coverage 74.75% 74.75% +<.01%
===========================================
Files 336 336
Lines 34219 34266 +47
Branches 5570 5583 +13
===========================================
+ Hits 25580 25617 +37
- Misses 7060 7065 +5
- Partials 1579 1584 +5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks plausible otherwise
synapse/event_auth.py
Outdated
# 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 (RoomVersions.V1, RoomVersions.V2): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surely event.format_version
should be an event version, not a room version?
# now let's look for events where the sender's domain is different to the | ||
# event id's domain (normally only the case for joins/leaves), and add additional | ||
# checks. Only do this if the room version has a concept of event ID domain | ||
if room_version in KNOWN_ROOM_VERSIONS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this not need to be different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It currently gets done in #4515, I'm not sure why I didn't write it out fully here
@@ -243,32 +245,22 @@ def _check_sigs_on_pdus(keyring, pdus): | |||
# | |||
# let's start by getting the domain for each pdu, and flattening the event back | |||
# to JSON. | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you update the comment at line 230 about event_id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
In future room version event IDs won't have a domain part