Enforce state key matches sender

This commit is contained in:
Neil Alexander 2022-01-04 15:33:42 +00:00
parent 85ede6d64b
commit e6be7f05c3
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -194,6 +194,12 @@ func SendJoin(
JSON: jsonerror.BadJSON("No state key was provided in the join event."), JSON: jsonerror.BadJSON("No state key was provided in the join event."),
} }
} }
if !event.StateKeyEquals(event.Sender()) {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.BadJSON("Event state key must match the event sender."),
}
}
// Check that the room ID is correct. // Check that the room ID is correct.
if event.RoomID() != roomID { if event.RoomID() != roomID {