From 67771735a9962f0a9aa2a553b5a3b09d1f4d320c Mon Sep 17 00:00:00 2001 From: iequidoo Date: Sun, 1 Oct 2023 00:06:44 -0300 Subject: [PATCH] feat: Move unverified messages which don't introduce a new Autocrypt key from protected 1:1 chats to ad-hoc groups This prevents protected 1:1 chats from breaking by messages sent by classical MUAs. TODO: Some `tests::verified_chats` tests are failing, but as far as i see from the log, the tests must be fixed, the change itself looks ok. Not fixing the tests now, not sure we will merge this as it's just POC. --- src/receive_imf.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/receive_imf.rs b/src/receive_imf.rs index dc5dc9ec5..fb92d7ab7 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -769,12 +769,12 @@ async fn add_parts( new_protection = match decryption_info.autocrypt_header.as_ref().filter(|ah| { Some(&ah.public_key.fingerprint()) - == decryption_info + != decryption_info .peerstate .as_ref() .and_then(|p| p.verified_key_fingerprint.as_ref()) }) { - Some(_) => { + None => { if let Some(new_chat_id) = create_adhoc_group( context, mime_parser, @@ -801,7 +801,7 @@ async fn add_parts( } chat.protected } - None => ProtectionStatus::ProtectionBroken, + Some(_) => ProtectionStatus::ProtectionBroken, }; } if chat.protected != new_protection {