diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-10-28 12:43:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-28 12:43:23 +0000 |
commit | 172f264ed38e8bef857552f93114b4ee113a880b (patch) | |
tree | cb6200a6249424c154d3540721c47f27e94ab9e6 /synapse/federation/federation_base.py | |
parent | Merge pull request #6255 from matrix-org/erikj/stats_config (diff) | |
download | synapse-172f264ed38e8bef857552f93114b4ee113a880b.tar.xz |
Improve signature checking on some federation APIs (#6262)
Make sure that we check that events sent over /send_join, /send_leave, and /invite, are correctly signed and come from the expected servers.
Diffstat (limited to 'synapse/federation/federation_base.py')
-rw-r--r-- | synapse/federation/federation_base.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/synapse/federation/federation_base.py b/synapse/federation/federation_base.py index 5a1e23a145..223aace0d9 100644 --- a/synapse/federation/federation_base.py +++ b/synapse/federation/federation_base.py @@ -278,9 +278,7 @@ def _check_sigs_on_pdus(keyring, room_version, pdus): pdu_to_check.sender_domain, e.getErrorMessage(), ) - # XX not really sure if these are the right codes, but they are what - # we've done for ages - raise SynapseError(400, errmsg, Codes.UNAUTHORIZED) + raise SynapseError(403, errmsg, Codes.FORBIDDEN) for p, d in zip(pdus_to_check_sender, more_deferreds): d.addErrback(sender_err, p) @@ -314,8 +312,7 @@ def _check_sigs_on_pdus(keyring, room_version, pdus): "event id %s: unable to verify signature for event id domain: %s" % (pdu_to_check.pdu.event_id, e.getErrorMessage()) ) - # XX as above: not really sure if these are the right codes - raise SynapseError(400, errmsg, Codes.UNAUTHORIZED) + raise SynapseError(403, errmsg, Codes.FORBIDDEN) for p, d in zip(pdus_to_check_event_id, more_deferreds): d.addErrback(event_err, p) |