1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Always block sending keys to unverified devices of verified users (#2562)

This commit is contained in:
Faye Duxovni
2022-08-04 11:11:12 -04:00
committed by GitHub
parent d867affc40
commit 43b453804b
2 changed files with 127 additions and 2 deletions

View File

@@ -1156,10 +1156,16 @@ class MegolmEncryption extends EncryptionAlgorithm {
continue;
}
const userTrust = this.crypto.checkUserTrust(userId);
const deviceTrust = this.crypto.checkDeviceTrust(userId, deviceId);
if (userDevices[deviceId].isBlocked() ||
(!deviceTrust.isVerified() && isBlacklisting)
(!deviceTrust.isVerified() && isBlacklisting) ||
// Always withhold keys from unverified devices of verified users
(!deviceTrust.isVerified() &&
userTrust.isVerified() &&
this.crypto.getCryptoTrustCrossSignedDevices()
)
) {
if (!blocked[userId]) {
blocked[userId] = {};