check invite target is our server.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-05-27 05:40:07 +00:00 committed by June 🍓🦴
parent c5569b4c6e
commit dc614e11d6

View file

@ -1759,7 +1759,14 @@ pub(crate) async fn create_invite_route(body: Ruma<create_invite::v2::Request>)
)
.map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "state_key is not a user id."))?;
// ACL check the invited user's server
if !server_is_ours(invited_user.server_name()) {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"User does not belong to this homeserver.",
));
}
// Make sure we're not ACL'ed from their room.
services()
.rooms
.event_handler