Don't answer expensive federation requests for rooms we no longer belong to (#2398)

This includes `/state`, `/state_ids`, `/get_missing_events` and `/backfill`.

This should fix #2396.
This commit is contained in:
Neil Alexander 2022-04-28 11:45:56 +01:00 committed by GitHub
parent 2ff75b7c80
commit 6deb10f3f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 0 deletions

View file

@ -30,6 +30,12 @@ func GetEventAuth(
roomID string,
eventID string,
) util.JSONResponse {
// If we don't think we belong to this room then don't waste the effort
// responding to expensive requests for it.
if err := ErrorIfLocalServerNotInRoom(ctx, rsAPI, roomID); err != nil {
return *err
}
event, resErr := fetchEvent(ctx, rsAPI, eventID)
if resErr != nil {
return *resErr