0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-30 17:34:04 +01:00

modules/m_room_redaction: Make redacts target room check an auth rule.

This commit is contained in:
Jason Volk 2019-08-16 05:32:32 -07:00
parent 100f5c646a
commit 09b52a2e65

View file

@ -76,6 +76,26 @@ ircd::m::auth_room_redaction(const m::event &event,
m::index(at<"redacts"_>(event), std::nothrow)
};
if(!redact_target_idx)
throw FAIL
{
"m.room.redaction redacts target is unknown."
};
const auto target_in_room
{
[&event](const string_view &room_id)
{
return room_id == at<"room_id"_>(event);
}
};
if(!m::query(std::nothrow, redact_target_idx, "room_id", target_in_room))
throw FAIL
{
"m.room.redaction redacts target is not in room."
};
const auto sender_domain_match
{
[&event](const string_view &tgt)
@ -84,12 +104,6 @@ ircd::m::auth_room_redaction(const m::event &event,
}
};
if(!redact_target_idx)
throw FAIL
{
"m.room.redaction redacts target is unknown."
};
if(m::query(std::nothrow, redact_target_idx, "redacts", sender_domain_match))
{
data.allow = true;