Remove dead code

These check the origin which is already checked in router auth
This commit is contained in:
dasha_uwu
2026-01-16 22:12:20 +05:00
committed by Jason Volk
parent 2f4d3c2851
commit 3a9446bb9c
5 changed files with 2 additions and 84 deletions

View File

@@ -21,7 +21,6 @@ use tuwunel_core::{
matrix::{Event, PduCount, PduEvent, event::gen_event_id},
utils,
utils::hash::sha256,
warn,
};
use crate::Ruma;
@@ -60,20 +59,6 @@ pub(crate) async fn create_invite_route(
return Err!(Request(Forbidden("Server is banned on this homeserver.")));
}
if services
.config
.forbidden_remote_server_names
.is_match(body.origin().host())
{
warn!(
"Received federated/remote invite from banned server {} for room ID {}. Rejecting.",
body.origin(),
body.room_id
);
return Err!(Request(Forbidden("Server is banned on this homeserver.")));
}
let mut signed_event = utils::to_canonical_object(&body.event)
.map_err(|_| err!(Request(InvalidParam("Invite event is invalid."))))?;

View File

@@ -12,7 +12,7 @@ use ruma::{
},
};
use tuwunel_core::{
Err, Error, Result, at, debug_info, matrix::pdu::PduBuilder, utils::IterStream, warn,
Err, Error, Result, at, debug_info, matrix::pdu::PduBuilder, utils::IterStream,
};
use tuwunel_service::Services;
@@ -39,21 +39,6 @@ pub(crate) async fn create_join_event_template_route(
.acl_check(body.origin(), &body.room_id)
.await?;
if services
.config
.forbidden_remote_server_names
.is_match(body.origin().host())
{
warn!(
"Server {} for remote user {} tried joining room ID {} which has a server name that \
is globally forbidden. Rejecting.",
body.origin(),
&body.user_id,
&body.room_id,
);
return Err!(Request(Forbidden("Server is banned on this homeserver.")));
}
if let Some(server) = body.room_id.server_name()
&& services
.config

View File

@@ -6,7 +6,7 @@ use ruma::{
api::{client::error::ErrorKind, federation::membership::prepare_knock_event},
events::room::member::{MembershipState, RoomMemberEventContent},
};
use tuwunel_core::{Err, Error, Result, at, debug_warn, matrix::pdu::PduBuilder, warn};
use tuwunel_core::{Err, Error, Result, at, debug_warn, matrix::pdu::PduBuilder};
use crate::Ruma;
@@ -31,21 +31,6 @@ pub(crate) async fn create_knock_event_template_route(
.acl_check(body.origin(), &body.room_id)
.await?;
if services
.config
.forbidden_remote_server_names
.is_match(body.origin().host())
{
warn!(
"Server {} for remote user {} tried knocking room ID {} which has a server name \
that is globally forbidden. Rejecting.",
body.origin(),
&body.user_id,
&body.room_id,
);
return Err!(Request(Forbidden("Server is banned on this homeserver.")));
}
if let Some(server) = body.room_id.server_name()
&& services
.config

View File

@@ -270,21 +270,6 @@ pub(crate) async fn create_join_event_v1_route(
State(services): State<crate::State>,
body: Ruma<create_join_event::v1::Request>,
) -> Result<create_join_event::v1::Response> {
if services
.config
.forbidden_remote_server_names
.is_match(body.origin().host())
{
warn!(
"Server {} tried joining room ID {} through us who has a server name that is \
globally forbidden. Rejecting.",
body.origin(),
&body.room_id,
);
return Err!(Request(Forbidden("Server is banned on this homeserver.")));
}
if let Some(server) = body.room_id.server_name()
&& services
.config
@@ -317,14 +302,6 @@ pub(crate) async fn create_join_event_v2_route(
State(services): State<crate::State>,
body: Ruma<create_join_event::v2::Request>,
) -> Result<create_join_event::v2::Response> {
if services
.config
.forbidden_remote_server_names
.is_match(body.origin().host())
{
return Err!(Request(Forbidden("Server is banned on this homeserver.")));
}
if let Some(server) = body.room_id.server_name()
&& services
.config

View File

@@ -25,20 +25,6 @@ pub(crate) async fn create_knock_event_v1_route(
State(services): State<crate::State>,
body: Ruma<create_knock_event::v1::Request>,
) -> Result<create_knock_event::v1::Response> {
if services
.config
.forbidden_remote_server_names
.is_match(body.origin().host())
{
warn!(
"Server {} tried knocking room ID {} who has a server name that is globally \
forbidden. Rejecting.",
body.origin(),
&body.room_id,
);
return Err!(Request(Forbidden("Server is banned on this homeserver.")));
}
if let Some(server) = body.room_id.server_name()
&& services
.config