From 4f0006d18a51b23eb826313b36af1a2586af98fe Mon Sep 17 00:00:00 2001 From: strawberry Date: Sun, 26 May 2024 14:50:40 -0400 Subject: [PATCH] ignore typing EDUs from ACL'd user's servers Signed-off-by: strawberry --- src/api/server_server.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/api/server_server.rs b/src/api/server_server.rs index 69200344..9cfceb3e 100644 --- a/src/api/server_server.rs +++ b/src/api/server_server.rs @@ -8,6 +8,7 @@ use std::{ }; use axum::{response::IntoResponse, Json}; +use conduit::{debug_info, debug_warn}; use get_profile_information::v1::ProfileField; use rand::seq::SliceRandom; use ruma::{ @@ -45,7 +46,7 @@ use ruma::{ serde::{Base64, JsonObject, Raw}, to_device::DeviceIdOrAllDevices, uint, user_id, CanonicalJsonValue, EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedServerName, - OwnedServerSigningKeyId, OwnedUserId, RoomId, RoomVersionId, ServerName, + OwnedServerSigningKeyId, OwnedUserId, RoomId, RoomVersionId, ServerName, UserId, }; use serde_json::value::{to_raw_value, RawValue as RawJsonValue}; use tokio::sync::RwLock; @@ -369,6 +370,16 @@ pub(crate) async fn send_transaction_message_route( continue; } + if services() + .rooms + .event_handler + .acl_check(typing.user_id.server_name(), &typing.room_id) + .is_err() + { + debug_warn!(%typing.user_id, %typing.room_id, "received typing EDU for ACL'd user's server"); + continue; + } + if services() .rooms .state_cache