diff --git a/include/ircd/m/event/conforms.h b/include/ircd/m/event/conforms.h index dca1b15d8..c86223cec 100644 --- a/include/ircd/m/event/conforms.h +++ b/include/ircd/m/event/conforms.h @@ -72,6 +72,7 @@ enum ircd::m::event::conforms::code 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 + MISMATCH_ALIASES_STATE_KEY, ///< m.room.aliases has no state_key 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 diff --git a/ircd/m_event.cc b/ircd/m_event.cc index 84d31e61b..c880ef426 100644 --- a/ircd/m_event.cc +++ b/ircd/m_event.cc @@ -176,6 +176,7 @@ ircd::m::event_conforms_reflects "MISMATCH_ORIGIN_SENDER", "MISMATCH_ORIGIN_EVENT_ID", "MISMATCH_CREATE_SENDER", + "MISMATCH_ALIASES_STATE_KEY", "SELF_REDACTS", "SELF_PREV_EVENT", "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()) 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(!valid(m::id::EVENT, json::get<"redacts"_>(e))) set(INVALID_OR_MISSING_REDACTS_ID);