Skip to content

Commit 4c28707

Browse files
committed
fix: do not allow chat creation if decryption failed
1 parent 09d18f9 commit 4c28707

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/receive_imf.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,9 @@ async fn add_parts(
761761
ShowEmails::from_i32(context.get_config_int(Config::ShowEmails).await?).unwrap_or_default();
762762

763763
let allow_creation;
764-
if mime_parser.is_system_message != SystemMessage::AutocryptSetupMessage
764+
if mime_parser.decrypting_failed {
765+
allow_creation = false;
766+
} else if mime_parser.is_system_message != SystemMessage::AutocryptSetupMessage
765767
&& is_dc_message == MessengerMessage::No
766768
&& !context.get_config_bool(Config::IsChatmail).await?
767769
{

src/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ mod tests {
612612

613613
// the same sync message sent to bob must not be executed
614614
let bob = TestContext::new_bob().await;
615-
bob.recv_msg(&sent_msg).await;
615+
bob.recv_msg_trash(&sent_msg).await;
616616
assert!(!token::exists(&bob, token::Namespace::Auth, "testtoken").await?);
617617

618618
Ok(())

src/tests/verified_chats.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -987,13 +987,10 @@ async fn test_verified_lost_member_added() -> Result<()> {
987987
assert_eq!(sent_msg.get_showpadlock(), true);
988988

989989
// The message will not be sent to Fiona.
990-
// Test that Fiona will not be able to decrypt it.
991-
let fiona_rcvd = fiona.recv_msg(&sent).await;
992-
assert_eq!(fiona_rcvd.get_showpadlock(), false);
993-
assert_eq!(
994-
fiona_rcvd.get_text(),
995-
"[...] – [This message was encrypted for another setup.]"
996-
);
990+
// Test that Fiona will not be able to decrypt it
991+
// and the message is trashed because
992+
// we don't create groups from undecipherable messages.
993+
fiona.recv_msg_trash(&sent).await;
997994

998995
// Advance the time so Alice does not leave at the same second
999996
// as the group was created.

0 commit comments

Comments
 (0)