mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 20:56:49 +00:00
2 files changed
+17
-1
No files matched your search
@@ -33,6 +33,16 @@ impl super::Service {
|
||||
return Err!(Request(Forbidden("Redacting m.room.create is not safe, forbidding.")));
|
||||
}
|
||||
|
||||
// Defense in depth, shouldn't be reachable
|
||||
if redacting_event
|
||||
.as_ref()
|
||||
.is_ok_and(|pdu| pdu.room_id() != Some(room_id))
|
||||
{
|
||||
return Err!(Request(Forbidden(
|
||||
"Cannot redact an event that belongs to a different room."
|
||||
)));
|
||||
}
|
||||
|
||||
if redacting_event
|
||||
.as_ref()
|
||||
.is_ok_and(|pdu| *pdu.kind() == TimelineEventType::RoomServerAcl)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use conduwuit::config::experiments::ToggledExperiment;
|
||||
use conduwuit_core::{
|
||||
Result, err,
|
||||
Err, Result, err,
|
||||
matrix::event::Event,
|
||||
utils::{self},
|
||||
warn,
|
||||
@@ -33,6 +33,12 @@ impl super::Service {
|
||||
err!(Database(error!(?pdu_id, %event_id, ?e, "PDU ID points to invalid PDU.")))
|
||||
})?;
|
||||
|
||||
if pdu.room_id() != reason.room_id() {
|
||||
return Err!(Request(Forbidden(
|
||||
"Cannot redact an event that belongs to a different room."
|
||||
)));
|
||||
}
|
||||
|
||||
let thread_root = match pdu.get_content::<ExtractRelatesTo>() {
|
||||
| Ok(ExtractRelatesTo { relates_to: Relation::Thread(thread) }) =>
|
||||
Some(thread.event_id),
|
||||
|
||||
Reference in new issue
Block a user