From d1b6b238bfa7a0938da56676e0d46d2fdb9aeef4 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Wed, 29 Jan 2020 11:55:33 -0400 Subject: [PATCH] schema check for incomplete data --- services/gunDB/contact-api/events.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/gunDB/contact-api/events.js b/services/gunDB/contact-api/events.js index b99d9e7f..42991976 100644 --- a/services/gunDB/contact-api/events.js +++ b/services/gunDB/contact-api/events.js @@ -343,6 +343,11 @@ const processOutgoings = async () => { return } + if (!Schema.isPartialOutgoing(out)) { + // incomplete data + return + } + if (typeof currentOutgoings[id] === 'undefined') { // We disable this rule because we are awaiting the result of the whole // for each AND each callback looks only at one single ID @@ -364,6 +369,10 @@ const processOutgoings = async () => { await Utils.asyncForEach( Object.entries(out.messages), async ([msgID, msg]) => { + if (!Schema.isMessage(msg)) { + // incomplete data + return + } if (!currentOut.messages[msgID]) { let decryptedBody = '' if (msg.body === Actions.INITIAL_MSG) {