From 6d4acdd01a33375ddf02ccecc08dc778334035db Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 9 Aug 2019 21:17:23 -0700 Subject: [PATCH] modules/m_event_append: Assertions that event being appended has fundamental fields. --- modules/m_event_append.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/m_event_append.cc b/modules/m_event_append.cc index 18aaf5f4f..c7f57310d 100644 --- a/modules/m_event_append.cc +++ b/modules/m_event_append.cc @@ -125,6 +125,14 @@ ircd::m::event::append::append(json::stack::object &object, }; #endif + // Assertions that the event being appended has some required fields. This + // is a central butt-end test of data coming through the system to here. + assert(event.event_id); + assert(defined(json::get<"type"_>(event))); + assert(defined(json::get<"sender"_>(event))); + //assert(json::get<"origin_server_ts"_>(event)); + //assert(json::get<"origin_server_ts"_>(event) != json::undefined_number); + if(has_event_idx && !defined(json::get<"state_key"_>(event)) && m::redacted(*opts.event_idx)) { log::debug