mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Clarify logging when PDU signature checking fails
This commit is contained in:
parent
ce6d47934b
commit
7ca638c761
@ -120,11 +120,9 @@ class Keyring(object):
|
|||||||
|
|
||||||
key_ids = signature_ids(json_object, server_name)
|
key_ids = signature_ids(json_object, server_name)
|
||||||
if not key_ids:
|
if not key_ids:
|
||||||
logger.warn("Request from %s: no supported signature keys",
|
|
||||||
server_name)
|
|
||||||
deferred = defer.fail(SynapseError(
|
deferred = defer.fail(SynapseError(
|
||||||
400,
|
400,
|
||||||
"Not signed with a supported algorithm",
|
"Not signed by %s" % (server_name, ),
|
||||||
Codes.UNAUTHORIZED,
|
Codes.UNAUTHORIZED,
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
|
@ -269,7 +269,17 @@ def _check_sigs_on_pdus(keyring, room_version, pdus):
|
|||||||
for p in pdus_to_check_sender
|
for p in pdus_to_check_sender
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def sender_err(e, pdu_to_check):
|
||||||
|
logger.warning(
|
||||||
|
"event id %s: unable to verify signature for sender %s: %s",
|
||||||
|
pdu_to_check.pdu.event_id,
|
||||||
|
pdu_to_check.sender_domain,
|
||||||
|
e,
|
||||||
|
)
|
||||||
|
return e
|
||||||
|
|
||||||
for p, d in zip(pdus_to_check_sender, more_deferreds):
|
for p, d in zip(pdus_to_check_sender, more_deferreds):
|
||||||
|
d.addErrback(sender_err, p)
|
||||||
p.deferreds.append(d)
|
p.deferreds.append(d)
|
||||||
|
|
||||||
# now let's look for events where the sender's domain is different to the
|
# now let's look for events where the sender's domain is different to the
|
||||||
@ -291,7 +301,16 @@ def _check_sigs_on_pdus(keyring, room_version, pdus):
|
|||||||
for p in pdus_to_check_event_id
|
for p in pdus_to_check_event_id
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def event_err(e, pdu_to_check):
|
||||||
|
logger.warning(
|
||||||
|
"event id %s: unable to verify signature for event id domain: %s",
|
||||||
|
pdu_to_check.pdu.event_id,
|
||||||
|
e,
|
||||||
|
)
|
||||||
|
return e
|
||||||
|
|
||||||
for p, d in zip(pdus_to_check_event_id, more_deferreds):
|
for p, d in zip(pdus_to_check_event_id, more_deferreds):
|
||||||
|
d.addErrback(event_err, p)
|
||||||
p.deferreds.append(d)
|
p.deferreds.append(d)
|
||||||
|
|
||||||
# replace lists of deferreds with single Deferreds
|
# replace lists of deferreds with single Deferreds
|
||||||
|
Loading…
Reference in New Issue
Block a user