From 8103bd7310c8ebae44bb4c6f3587dfb77853e3bd Mon Sep 17 00:00:00 2001 From: strawberry Date: Fri, 7 Jun 2024 01:45:00 -0400 Subject: [PATCH] fix(fed): dont reject `/backfill/` on world readable rooms Signed-off-by: strawberry --- src/api/server/backfill.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/api/server/backfill.rs b/src/api/server/backfill.rs index e8da77f2..e3ff82e4 100644 --- a/src/api/server/backfill.rs +++ b/src/api/server/backfill.rs @@ -12,19 +12,23 @@ use crate::{services, Error, PduEvent, Result, Ruma}; pub(crate) async fn get_backfill_route(body: Ruma) -> Result { 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() .rooms .event_handler .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 .v .iter()