mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 18:22:50 +01:00
ircd:Ⓜ️:event::conforms: Add check for room_id host matching sender host for create event.
This commit is contained in:
parent
1bd9ce0d1e
commit
903a117bf7
2 changed files with 6 additions and 0 deletions
|
@ -71,6 +71,7 @@ enum ircd::m::event::conforms::code
|
|||
MISSING_ORIGIN_SIGNATURE, ///< no signature for origin
|
||||
MISMATCH_ORIGIN_SENDER, ///< sender mxid host not from origin
|
||||
MISMATCH_ORIGIN_EVENT_ID, ///< event_id mxid host not from origin
|
||||
MISMATCH_CREATE_SENDER, ///< m.room.create room_id host != sender host
|
||||
SELF_REDACTS, ///< event redacts itself
|
||||
SELF_PREV_EVENT, ///< event_id self-referenced in prev_events
|
||||
SELF_PREV_STATE, ///< event_id self-referenced in prev_state
|
||||
|
|
|
@ -175,6 +175,7 @@ ircd::m::event_conforms_reflects
|
|||
"MISSING_ORIGIN_SIGNATURE",
|
||||
"MISMATCH_ORIGIN_SENDER",
|
||||
"MISMATCH_ORIGIN_EVENT_ID",
|
||||
"MISMATCH_CREATE_SENDER",
|
||||
"SELF_REDACTS",
|
||||
"SELF_PREV_EVENT",
|
||||
"SELF_PREV_STATE",
|
||||
|
@ -263,6 +264,10 @@ ircd::m::event::conforms::conforms(const event &e)
|
|||
if(json::get<"origin"_>(e) != m::id::event{json::get<"event_id"_>(e)}.host())
|
||||
set(MISMATCH_ORIGIN_EVENT_ID);
|
||||
|
||||
if(json::get<"type"_>(e) == "m.room.create")
|
||||
if(m::room::id(json::get<"room_id"_>(e)).host() != m::user::id(json::get<"sender"_>(e)).host())
|
||||
set(MISMATCH_CREATE_SENDER);
|
||||
|
||||
if(json::get<"type"_>(e) == "m.room.redaction")
|
||||
if(!valid(m::id::EVENT, json::get<"redacts"_>(e)))
|
||||
set(INVALID_OR_MISSING_REDACTS_ID);
|
||||
|
|
Loading…
Reference in a new issue