Redact event if signature check fails

This commit is contained in:
Neil Alexander 2021-06-21 15:54:40 +01:00
parent 5357df36c9
commit d6cb8cc242
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -235,13 +235,16 @@ func (t *txnReq) processTransaction(ctx context.Context) (*gomatrixserverlib.Res
continue
}
if err = gomatrixserverlib.VerifyAllEventSignatures(ctx, []*gomatrixserverlib.Event{event}, t.keys); err != nil {
util.GetLogger(ctx).WithError(err).Warnf("Transaction: Couldn't validate signature of event %q", event.EventID())
results[event.EventID()] = gomatrixserverlib.PDUResult{
Error: err.Error(),
}
continue
event = event.Redact()
/*
util.GetLogger(ctx).WithError(err).Warnf("Transaction: Couldn't validate signature of event %q", event.EventID())
results[event.EventID()] = gomatrixserverlib.PDUResult{
Error: err.Error(),
}
continue
*/
}
pdus = append(pdus, event.Headered(verRes.RoomVersion))
pdus = append(pdus, event.Redact().Headered(verRes.RoomVersion))
}
// Process the events.