From 4030cd29002a9bd0d887eda33461ce317c697210 Mon Sep 17 00:00:00 2001 From: Cnly Date: Thu, 30 May 2019 21:58:29 +0800 Subject: [PATCH] Make federation state request 404 when event not in the room - fixes #625 Signed-off-by: Alex Chen --- federationapi/routing/state.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/federationapi/routing/state.go b/federationapi/routing/state.go index 58398bde9..86cf1cf54 100644 --- a/federationapi/routing/state.go +++ b/federationapi/routing/state.go @@ -103,6 +103,10 @@ func getState( return nil, resErr } + if event.RoomID() != roomID { + return nil, &util.JSONResponse{Code: http.StatusNotFound, JSON: nil} + } + prevEventIDs := getIDsFromEventRef(event.PrevEvents()) authEventIDs := getIDsFromEventRef(event.AuthEvents())