mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +03:00
fix: do not allow chat creation if decryption failed
This commit is contained in:
@@ -761,7 +761,9 @@ async fn add_parts(
|
|||||||
ShowEmails::from_i32(context.get_config_int(Config::ShowEmails).await?).unwrap_or_default();
|
ShowEmails::from_i32(context.get_config_int(Config::ShowEmails).await?).unwrap_or_default();
|
||||||
|
|
||||||
let allow_creation;
|
let allow_creation;
|
||||||
if mime_parser.is_system_message != SystemMessage::AutocryptSetupMessage
|
if mime_parser.decrypting_failed {
|
||||||
|
allow_creation = false;
|
||||||
|
} else if mime_parser.is_system_message != SystemMessage::AutocryptSetupMessage
|
||||||
&& is_dc_message == MessengerMessage::No
|
&& is_dc_message == MessengerMessage::No
|
||||||
&& !context.get_config_bool(Config::IsChatmail).await?
|
&& !context.get_config_bool(Config::IsChatmail).await?
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -612,7 +612,7 @@ mod tests {
|
|||||||
|
|
||||||
// the same sync message sent to bob must not be executed
|
// the same sync message sent to bob must not be executed
|
||||||
let bob = TestContext::new_bob().await;
|
let bob = TestContext::new_bob().await;
|
||||||
bob.recv_msg(&sent_msg).await;
|
bob.recv_msg_trash(&sent_msg).await;
|
||||||
assert!(!token::exists(&bob, token::Namespace::Auth, "testtoken").await?);
|
assert!(!token::exists(&bob, token::Namespace::Auth, "testtoken").await?);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -987,13 +987,10 @@ async fn test_verified_lost_member_added() -> Result<()> {
|
|||||||
assert_eq!(sent_msg.get_showpadlock(), true);
|
assert_eq!(sent_msg.get_showpadlock(), true);
|
||||||
|
|
||||||
// The message will not be sent to Fiona.
|
// The message will not be sent to Fiona.
|
||||||
// Test that Fiona will not be able to decrypt it.
|
// Test that Fiona will not be able to decrypt it
|
||||||
let fiona_rcvd = fiona.recv_msg(&sent).await;
|
// and the message is trashed because
|
||||||
assert_eq!(fiona_rcvd.get_showpadlock(), false);
|
// we don't create groups from undecipherable messages.
|
||||||
assert_eq!(
|
fiona.recv_msg_trash(&sent).await;
|
||||||
fiona_rcvd.get_text(),
|
|
||||||
"[...] – [This message was encrypted for another setup.]"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Advance the time so Alice does not leave at the same second
|
// Advance the time so Alice does not leave at the same second
|
||||||
// as the group was created.
|
// as the group was created.
|
||||||
|
|||||||
Reference in New Issue
Block a user