mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
feat: Don't affect MimeMessage with "From" and secured headers from encrypted unsigned messages
If a message is encrypted, but unsigned: - Don't set `MimeMessage::from_is_signed`. - Remove "secure-join-fingerprint" and "chat-verified" headers from `MimeMessage`. - Minor: Preserve "Subject" from the unencrypted top level if there's no "Subject" in the encrypted part, this message is displayed w/o a padlock anyway. Apparently it didn't lead to any vulnerabilities because there are checks for `MimeMessage::signatures.is_empty()` in all necessary places, but still the code looked dangerous, especially because `from_is_singed` var name didn't correspond to its actual value (it was rather `from_is_encrypted_maybe_signed`).
This commit is contained in:
@@ -705,9 +705,7 @@ pub(crate) async fn maybe_do_aeap_transition(
|
||||
// addresses with an MUA.
|
||||
&& mime_parser.has_chat_version()
|
||||
// Check if the message is signed correctly.
|
||||
// If it's not signed correctly, the whole autocrypt header will be mostly
|
||||
// ignored anyway and the message shown as not encrypted, so we don't
|
||||
// have to handle this case.
|
||||
// Although checking `from_is_signed` below is sufficient, let's play it safe.
|
||||
&& !mime_parser.signatures.is_empty()
|
||||
// Check if the From: address was also in the signed part of the email.
|
||||
// Without this check, an attacker could replay a message from Alice
|
||||
|
||||
Reference in New Issue
Block a user