Skip to content
Snippets Groups Projects
Commit f31b7b94 authored by 🥺's avatar 🥺 :transgender_flag: Committed by 🥺
Browse files

ignore inbound EDUs for users that dont belong to origin server

parent e5e358cc
No related branches found
No related tags found
No related merge requests found
...@@ -332,6 +332,11 @@ pub(crate) async fn send_transaction_message_route( ...@@ -332,6 +332,11 @@ pub(crate) async fn send_transaction_message_route(
} }
for update in presence.push { for update in presence.push {
if update.user_id.server_name() != origin {
debug_warn!(%update.user_id, %origin, "received presence EDU for user not belonging to origin");
continue;
}
services().presence.set_presence( services().presence.set_presence(
&update.user_id, &update.user_id,
&update.presence, &update.presence,
...@@ -348,6 +353,11 @@ pub(crate) async fn send_transaction_message_route( ...@@ -348,6 +353,11 @@ pub(crate) async fn send_transaction_message_route(
for (room_id, room_updates) in receipt.receipts { for (room_id, room_updates) in receipt.receipts {
for (user_id, user_updates) in room_updates.read { for (user_id, user_updates) in room_updates.read {
if user_id.server_name() != origin {
debug_warn!(%user_id, %origin, "received read receipt EDU for user not belonging to origin");
continue;
}
if services() if services()
.rooms .rooms
.event_handler .event_handler
...@@ -406,6 +416,11 @@ pub(crate) async fn send_transaction_message_route( ...@@ -406,6 +416,11 @@ pub(crate) async fn send_transaction_message_route(
continue; continue;
} }
if typing.user_id.server_name() != origin {
debug_warn!(%typing.user_id, %origin, "received typing EDU for user not belonging to origin");
continue;
}
if services() if services()
.rooms .rooms
.event_handler .event_handler
...@@ -450,6 +465,11 @@ pub(crate) async fn send_transaction_message_route( ...@@ -450,6 +465,11 @@ pub(crate) async fn send_transaction_message_route(
user_id, user_id,
.. ..
}) => { }) => {
if user_id.server_name() != origin {
debug_warn!(%user_id, %origin, "received device list update EDU for user not belonging to origin");
continue;
}
services().users.mark_device_key_update(&user_id)?; services().users.mark_device_key_update(&user_id)?;
}, },
Edu::DirectToDevice(DirectDeviceContent { Edu::DirectToDevice(DirectDeviceContent {
...@@ -458,6 +478,11 @@ pub(crate) async fn send_transaction_message_route( ...@@ -458,6 +478,11 @@ pub(crate) async fn send_transaction_message_route(
message_id, message_id,
messages, messages,
}) => { }) => {
if sender.server_name() != origin {
debug_warn!(%sender, %origin, "received direct to device EDU for user not belonging to origin");
continue;
}
// Check if this is a new transaction id // Check if this is a new transaction id
if services() if services()
.transaction_ids .transaction_ids
...@@ -514,13 +539,16 @@ pub(crate) async fn send_transaction_message_route( ...@@ -514,13 +539,16 @@ pub(crate) async fn send_transaction_message_route(
debug_info!(%user_id, %origin, "received signing key update EDU from server that does not belong to user's server"); debug_info!(%user_id, %origin, "received signing key update EDU from server that does not belong to user's server");
continue; continue;
} }
if let Some(master_key) = master_key { if let Some(master_key) = master_key {
services() services()
.users .users
.add_cross_signing_keys(&user_id, &master_key, &self_signing_key, &None, true)?; .add_cross_signing_keys(&user_id, &master_key, &self_signing_key, &None, true)?;
} }
}, },
Edu::_Custom(_) => {}, Edu::_Custom(custom) => {
debug_info!(?custom, "received custom/unknown EDU");
},
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment