From b88112b05db9da292d39b165f91b9af293c88500 Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Tue, 25 Jun 2019 18:32:15 +0800 Subject: [PATCH] Make federation state request 404 when event not in the room - fixes #625 (#716) 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())