diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-04-29 13:19:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-29 13:19:32 +0100 |
commit | b31cc1c6132433d0bcf67e245ab19ba1b2cc5c4f (patch) | |
tree | 75480ec5d8797f38b7510c54ba9df3df30b6ae51 /synapse/federation/federation_base.py | |
parent | Merge pull request #5103 from matrix-org/rav/fix_notif_loop (diff) | |
parent | changelog (diff) | |
download | synapse-b31cc1c6132433d0bcf67e245ab19ba1b2cc5c4f.tar.xz |
Merge pull request #5100 from matrix-org/rav/verification_hackery
Improve logging when event-signature checking fails
Diffstat (limited to 'synapse/federation/federation_base.py')
-rw-r--r-- | synapse/federation/federation_base.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/synapse/federation/federation_base.py b/synapse/federation/federation_base.py index dfe6b4aa5c..cffa831d80 100644 --- a/synapse/federation/federation_base.py +++ b/synapse/federation/federation_base.py @@ -269,7 +269,18 @@ def _check_sigs_on_pdus(keyring, room_version, pdus): for p in pdus_to_check_sender ]) + def sender_err(e, pdu_to_check): + errmsg = "event id %s: unable to verify signature for sender %s: %s" % ( + pdu_to_check.pdu.event_id, + 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) + for p, d in zip(pdus_to_check_sender, more_deferreds): + d.addErrback(sender_err, p) p.deferreds.append(d) # now let's look for events where the sender's domain is different to the @@ -291,7 +302,18 @@ def _check_sigs_on_pdus(keyring, room_version, pdus): for p in pdus_to_check_event_id ]) + def event_err(e, pdu_to_check): + errmsg = ( + "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) + for p, d in zip(pdus_to_check_event_id, more_deferreds): + d.addErrback(event_err, p) p.deferreds.append(d) # replace lists of deferreds with single Deferreds |