From f84a33910c1cb1bcce728da2678edb3a94247859 Mon Sep 17 00:00:00 2001 From: mcalinghee Date: Tue, 4 Oct 2022 14:31:21 +0200 Subject: [PATCH] Unexpected ignored self key request when it's not shared history (#2724) * ignore forwarded key process also if the user is not the same --- src/crypto/algorithms/megolm.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/crypto/algorithms/megolm.ts b/src/crypto/algorithms/megolm.ts index dbd9c6596..a831c5650 100644 --- a/src/crypto/algorithms/megolm.ts +++ b/src/crypto/algorithms/megolm.ts @@ -1444,9 +1444,10 @@ class MegolmDecryption extends DecryptionAlgorithm { memberEvent?.getPrevContent()?.membership === "invite"); const fromUs = event.getSender() === this.baseApis.getUserId(); - if (!weRequested) { - // If someone sends us an unsolicited key and it's not - // shared history, ignore it + if (!weRequested && !fromUs) { + // If someone sends us an unsolicited key and they're + // not one of our other devices and it's not shared + // history, ignore it if (!extraSessionData.sharedHistory) { logger.log("forwarded key not shared history - ignoring"); return; @@ -1455,7 +1456,7 @@ class MegolmDecryption extends DecryptionAlgorithm { // If someone sends us an unsolicited key for a room // we're already in, and they're not one of our other // devices or the one who invited us, ignore it - if (room && !fromInviter && !fromUs) { + if (room && !fromInviter) { logger.log("forwarded key not from inviter or from us - ignoring"); return; }