0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-12 13:01:07 +01:00

ircd:Ⓜ️:event::conforms: Add check for m.room.aliases sender host vs. state_key.

This commit is contained in:
Jason Volk 2019-02-12 15:34:40 -08:00
parent 903a117bf7
commit 7117d4a17c
2 changed files with 6 additions and 0 deletions

View file

@ -72,6 +72,7 @@ enum ircd::m::event::conforms::code
MISMATCH_ORIGIN_SENDER, ///< sender mxid host not from origin MISMATCH_ORIGIN_SENDER, ///< sender mxid host not from origin
MISMATCH_ORIGIN_EVENT_ID, ///< event_id 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 MISMATCH_CREATE_SENDER, ///< m.room.create room_id host != sender host
MISMATCH_ALIASES_STATE_KEY, ///< m.room.aliases has no state_key
SELF_REDACTS, ///< event redacts itself SELF_REDACTS, ///< event redacts itself
SELF_PREV_EVENT, ///< event_id self-referenced in prev_events SELF_PREV_EVENT, ///< event_id self-referenced in prev_events
SELF_PREV_STATE, ///< event_id self-referenced in prev_state SELF_PREV_STATE, ///< event_id self-referenced in prev_state

View file

@ -176,6 +176,7 @@ ircd::m::event_conforms_reflects
"MISMATCH_ORIGIN_SENDER", "MISMATCH_ORIGIN_SENDER",
"MISMATCH_ORIGIN_EVENT_ID", "MISMATCH_ORIGIN_EVENT_ID",
"MISMATCH_CREATE_SENDER", "MISMATCH_CREATE_SENDER",
"MISMATCH_ALIASES_STATE_KEY",
"SELF_REDACTS", "SELF_REDACTS",
"SELF_PREV_EVENT", "SELF_PREV_EVENT",
"SELF_PREV_STATE", "SELF_PREV_STATE",
@ -268,6 +269,10 @@ ircd::m::event::conforms::conforms(const event &e)
if(m::room::id(json::get<"room_id"_>(e)).host() != m::user::id(json::get<"sender"_>(e)).host()) if(m::room::id(json::get<"room_id"_>(e)).host() != m::user::id(json::get<"sender"_>(e)).host())
set(MISMATCH_CREATE_SENDER); set(MISMATCH_CREATE_SENDER);
if(json::get<"type"_>(e) == "m.room.aliases")
if(m::user::id(json::get<"sender"_>(e)).host() != json::get<"state_key"_>(e))
set(MISMATCH_ALIASES_STATE_KEY);
if(json::get<"type"_>(e) == "m.room.redaction") if(json::get<"type"_>(e) == "m.room.redaction")
if(!valid(m::id::EVENT, json::get<"redacts"_>(e))) if(!valid(m::id::EVENT, json::get<"redacts"_>(e)))
set(INVALID_OR_MISSING_REDACTS_ID); set(INVALID_OR_MISSING_REDACTS_ID);