Remove dead code
These check the origin which is already checked in router auth
This commit is contained in:
@@ -21,7 +21,6 @@ use tuwunel_core::{
|
|||||||
matrix::{Event, PduCount, PduEvent, event::gen_event_id},
|
matrix::{Event, PduCount, PduEvent, event::gen_event_id},
|
||||||
utils,
|
utils,
|
||||||
utils::hash::sha256,
|
utils::hash::sha256,
|
||||||
warn,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
@@ -60,20 +59,6 @@ pub(crate) async fn create_invite_route(
|
|||||||
return Err!(Request(Forbidden("Server is banned on this homeserver.")));
|
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)
|
let mut signed_event = utils::to_canonical_object(&body.event)
|
||||||
.map_err(|_| err!(Request(InvalidParam("Invite event is invalid."))))?;
|
.map_err(|_| err!(Request(InvalidParam("Invite event is invalid."))))?;
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use ruma::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
use tuwunel_core::{
|
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;
|
use tuwunel_service::Services;
|
||||||
|
|
||||||
@@ -39,21 +39,6 @@ pub(crate) async fn create_join_event_template_route(
|
|||||||
.acl_check(body.origin(), &body.room_id)
|
.acl_check(body.origin(), &body.room_id)
|
||||||
.await?;
|
.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()
|
if let Some(server) = body.room_id.server_name()
|
||||||
&& services
|
&& services
|
||||||
.config
|
.config
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use ruma::{
|
|||||||
api::{client::error::ErrorKind, federation::membership::prepare_knock_event},
|
api::{client::error::ErrorKind, federation::membership::prepare_knock_event},
|
||||||
events::room::member::{MembershipState, RoomMemberEventContent},
|
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;
|
use crate::Ruma;
|
||||||
|
|
||||||
@@ -31,21 +31,6 @@ pub(crate) async fn create_knock_event_template_route(
|
|||||||
.acl_check(body.origin(), &body.room_id)
|
.acl_check(body.origin(), &body.room_id)
|
||||||
.await?;
|
.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()
|
if let Some(server) = body.room_id.server_name()
|
||||||
&& services
|
&& services
|
||||||
.config
|
.config
|
||||||
|
|||||||
@@ -270,21 +270,6 @@ pub(crate) async fn create_join_event_v1_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<create_join_event::v1::Request>,
|
body: Ruma<create_join_event::v1::Request>,
|
||||||
) -> Result<create_join_event::v1::Response> {
|
) -> 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()
|
if let Some(server) = body.room_id.server_name()
|
||||||
&& services
|
&& services
|
||||||
.config
|
.config
|
||||||
@@ -317,14 +302,6 @@ pub(crate) async fn create_join_event_v2_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<create_join_event::v2::Request>,
|
body: Ruma<create_join_event::v2::Request>,
|
||||||
) -> Result<create_join_event::v2::Response> {
|
) -> 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()
|
if let Some(server) = body.room_id.server_name()
|
||||||
&& services
|
&& services
|
||||||
.config
|
.config
|
||||||
|
|||||||
@@ -25,20 +25,6 @@ pub(crate) async fn create_knock_event_v1_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<create_knock_event::v1::Request>,
|
body: Ruma<create_knock_event::v1::Request>,
|
||||||
) -> Result<create_knock_event::v1::Response> {
|
) -> 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()
|
if let Some(server) = body.room_id.server_name()
|
||||||
&& services
|
&& services
|
||||||
.config
|
.config
|
||||||
|
|||||||
Reference in New Issue
Block a user