Skip to content

Commit f84a339

Browse files
authored
Unexpected ignored self key request when it's not shared history (#2724)
* ignore forwarded key process also if the user is not the same
1 parent 0ccf7c5 commit f84a339

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/crypto/algorithms/megolm.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,9 +1444,10 @@ class MegolmDecryption extends DecryptionAlgorithm {
14441444
memberEvent?.getPrevContent()?.membership === "invite");
14451445
const fromUs = event.getSender() === this.baseApis.getUserId();
14461446

1447-
if (!weRequested) {
1448-
// If someone sends us an unsolicited key and it's not
1449-
// shared history, ignore it
1447+
if (!weRequested && !fromUs) {
1448+
// If someone sends us an unsolicited key and they're
1449+
// not one of our other devices and it's not shared
1450+
// history, ignore it
14501451
if (!extraSessionData.sharedHistory) {
14511452
logger.log("forwarded key not shared history - ignoring");
14521453
return;
@@ -1455,7 +1456,7 @@ class MegolmDecryption extends DecryptionAlgorithm {
14551456
// If someone sends us an unsolicited key for a room
14561457
// we're already in, and they're not one of our other
14571458
// devices or the one who invited us, ignore it
1458-
if (room && !fromInviter && !fromUs) {
1459+
if (room && !fromInviter) {
14591460
logger.log("forwarded key not from inviter or from us - ignoring");
14601461
return;
14611462
}

0 commit comments

Comments
 (0)