diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-09-12 12:30:41 +0100 |
---|---|---|
committer | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-09-12 13:30:51 +0100 |
commit | 2792d0490f3771488bad346981b8c26479a872c3 (patch) | |
tree | f01f65d18828d93fed12afe02d5b7155c1061392 | |
parent | 7595fbf58c67fd8f0f879498f865f4871e652ddb (diff) |
Fix missing signature check on the `/get_missing_events` response
-rw-r--r-- | roomserver/internal/input/input_missing.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/roomserver/internal/input/input_missing.go b/roomserver/internal/input/input_missing.go index 0dd2b64c..d789c3a1 100644 --- a/roomserver/internal/input/input_missing.go +++ b/roomserver/internal/input/input_missing.go @@ -553,11 +553,14 @@ func (t *missingStateReq) getMissingEvents(ctx context.Context, e *gomatrixserve // Make sure events from the missingResp are using the cache - missing events // will be added and duplicates will be removed. - logger.Debugf("get_missing_events returned %d events", len(missingResp.Events)) missingEvents := make([]*gomatrixserverlib.Event, 0, len(missingResp.Events)) for _, ev := range missingResp.Events.UntrustedEvents(roomVersion) { + if err = ev.VerifyEventSignatures(ctx, t.keys); err != nil { + continue + } missingEvents = append(missingEvents, t.cacheAndReturn(ev)) } + logger.Debugf("get_missing_events returned %d events (%d passed signature checks)", len(missingResp.Events), len(missingEvents)) // topologically sort and sanity check that we are making forward progress newEvents = gomatrixserverlib.ReverseTopologicalOrdering(missingEvents, gomatrixserverlib.TopologicalOrderByPrevEvents) |