From 583df7ed7d877f51e048ed31552ef5fbe26ac44c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 24 Jan 2020 12:23:18 +0100 Subject: [PATCH] don't log verification validation errors for normal messages --- src/crypto/verification/request/InRoomChannel.js | 4 +++- .../verification/request/VerificationRequest.js | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/crypto/verification/request/InRoomChannel.js b/src/crypto/verification/request/InRoomChannel.js index ed0613a82..15d522509 100644 --- a/src/crypto/verification/request/InRoomChannel.js +++ b/src/crypto/verification/request/InRoomChannel.js @@ -128,11 +128,13 @@ export class InRoomChannel { static validateEvent(event, client) { const txnId = InRoomChannel.getTransactionId(event); if (typeof txnId !== "string" || txnId.length === 0) { - logger.log("InRoomChannel: validateEvent: no valid txnId " + txnId); return false; } const type = InRoomChannel.getEventType(event); const content = event.getContent(); + + // from here on we're fairly sure that this is supposed to be + // part of a verification request, so be noisy when rejecting something if (type === REQUEST_TYPE) { if (!content || typeof content.to !== "string" || !content.to.length) { logger.log("InRoomChannel: validateEvent: " + diff --git a/src/crypto/verification/request/VerificationRequest.js b/src/crypto/verification/request/VerificationRequest.js index 3957511c3..7d26f0ed1 100644 --- a/src/crypto/verification/request/VerificationRequest.js +++ b/src/crypto/verification/request/VerificationRequest.js @@ -82,13 +82,15 @@ export class VerificationRequest extends EventEmitter { static validateEvent(type, event, client) { const content = event.getContent(); - if (!content) { - logger.log("VerificationRequest: validateEvent: no content"); - } if (!type.startsWith(EVENT_PREFIX)) { - logger.log("VerificationRequest: validateEvent: " + - "fail because type doesnt start with " + EVENT_PREFIX); + return false; + } + + // from here on we're fairly sure that this is supposed to be + // part of a verification request, so be noisy when rejecting something + if (!content) { + logger.log("VerificationRequest: validateEvent: no content"); return false; }