From ff82452816449eb9ccea872bf192cf153d596858 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 19 Nov 2023 20:09:38 +0100 Subject: Upgrade trust of megolm sessions when receiving RoomKey Before we only did that, when we basically didn't have the key yet. But since we usually get sent a RoomKey when a new message is sent after we sign in, we were discarding, that those messages should usually now be trusted. --- src/CacheCryptoStructs.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/CacheCryptoStructs.h') diff --git a/src/CacheCryptoStructs.h b/src/CacheCryptoStructs.h index 2a5b895f..22c7bcf0 100644 --- a/src/CacheCryptoStructs.h +++ b/src/CacheCryptoStructs.h @@ -22,10 +22,12 @@ QML_NAMED_ELEMENT(Crypto) //! How much a participant is trusted. enum Trust { - Unverified, //! Device unverified or master key changed. - TOFU, //! Device is signed by the sender, but the user is not verified, but they never - //! changed the master key. - Verified, //! User was verified and has crosssigned this device or device is verified. + Unverified, //! Device unverified or master key changed. + MessageUnverified, //! Only for messages. The sender might be trusted, but we don't know, who + //! was the sender for the message. + TOFU, //! Device is signed by the sender, but the user is not verified, but they never + //! changed the master key. + Verified, //! User was verified and has crosssigned this device or device is verified. }; Q_ENUM_NS(Trust) } @@ -50,10 +52,9 @@ struct GroupSessionData uint64_t timestamp = 0; uint32_t message_index = 0; - // If we got the session via key sharing or forwarding, we can usually trust it. - // If it came from asymmetric key backup, it is not trusted. - // TODO(Nico): What about forwards? They might come from key backup? - bool trusted = true; + // We generally don't trust keys unless they were sent to us by the original sender and include + // that senders signature. + bool trusted = false; // the original 25519 key std::string sender_key; -- cgit 1.5.1