fix(fed): dont reject /backfill/ on world readable rooms

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-06-07 01:45:00 -04:00
parent 81487e3f07
commit 8103bd7310

View file

@ -12,19 +12,23 @@ use crate::{services, Error, PduEvent, Result, Ruma};
pub(crate) async fn get_backfill_route(body: Ruma<get_backfill::v1::Request>) -> Result<get_backfill::v1::Response> { pub(crate) async fn get_backfill_route(body: Ruma<get_backfill::v1::Request>) -> Result<get_backfill::v1::Response> {
let origin = body.origin.as_ref().expect("server is authenticated"); let origin = body.origin.as_ref().expect("server is authenticated");
if !services()
.rooms
.state_cache
.server_in_room(origin, &body.room_id)?
{
return Err(Error::BadRequest(ErrorKind::forbidden(), "Server is not in room."));
}
services() services()
.rooms .rooms
.event_handler .event_handler
.acl_check(origin, &body.room_id)?; .acl_check(origin, &body.room_id)?;
if !services()
.rooms
.state_accessor
.is_world_readable(&body.room_id)?
&& !services()
.rooms
.state_cache
.server_in_room(origin, &body.room_id)?
{
return Err(Error::BadRequest(ErrorKind::forbidden(), "Server is not in room."));
}
let until = body let until = body
.v .v
.iter() .iter()