fix: Remove unsigned Chat-Group-* headers from Autocrypt-encrypted messages

These headers are opportunistically protected, so if they appear in the unencrypted part, they are
probably added by a malicious server.
This commit is contained in:
iequidoo
2024-02-13 12:43:59 -03:00
committed by link2xt
parent 8d09291d1e
commit 1a1467f7cf
2 changed files with 40 additions and 3 deletions

View File

@@ -348,9 +348,20 @@ impl MimeMessage {
gossip_headers,
)
.await?;
// Remove unsigned subject from messages displayed with padlock.
// See <https://github.com/deltachat/deltachat-core-rust/issues/1790>.
headers.remove("subject");
// Remove unsigned opportunistically protected headers from messages considered
// Autocrypt-encrypted / displayed with padlock.
// For "Subject" see <https://github.com/deltachat/deltachat-core-rust/issues/1790>.
for h in [
HeaderDef::Subject,
HeaderDef::ChatGroupId,
HeaderDef::ChatGroupName,
HeaderDef::ChatGroupNameChanged,
HeaderDef::ChatGroupAvatar,
HeaderDef::ChatGroupMemberRemoved,
HeaderDef::ChatGroupMemberAdded,
] {
headers.remove(h.get_headername());
}
}
// let known protected headers from the decrypted