diff --git a/src/service/admin/debug/debug_commands.rs b/src/service/admin/debug/debug_commands.rs index d4a82c2a..aae4b948 100644 --- a/src/service/admin/debug/debug_commands.rs +++ b/src/service/admin/debug/debug_commands.rs @@ -103,6 +103,18 @@ pub(super) async fn get_pdu(_body: Vec<&str>, event_id: Box) -> Result< pub(super) async fn get_remote_pdu_list( body: Vec<&str>, server: Box, force: bool, ) -> Result { + if !services().globals.config.allow_federation { + return Ok(RoomMessageEventContent::text_plain( + "Federation is disabled on this homeserver.", + )); + } + + if server == services().globals.server_name() { + return Ok(RoomMessageEventContent::text_plain( + "Not allowed to send federation requests to ourselves. Please use `get-pdu` for fetching local PDUs.", + )); + } + if body.len() > 2 && body[0].trim().starts_with("```") && body.last().unwrap().trim() == "```" { let list = body .clone()