Skip to content

Commit 4571113

Browse files
committed
fix: process Autocrypt-Gossip only after merging protected headers
Otherwise no Autocrypt-Gossip is applied if To header is protected by replacing with "hidden-recipients".
1 parent c825b25 commit 4571113

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/mimeparser.rs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -421,19 +421,6 @@ impl MimeMessage {
421421
timestamp_sent =
422422
Self::get_timestamp_sent(&mail.headers, timestamp_sent, timestamp_rcvd);
423423
if !signatures.is_empty() {
424-
// Handle any gossip headers if the mail was encrypted. See section
425-
// "3.6 Key Gossip" of <https://autocrypt.org/autocrypt-spec-1.1.0.pdf>
426-
// but only if the mail was correctly signed. Probably it's ok to not require
427-
// encryption here, but let's follow the standard.
428-
let gossip_headers = mail.headers.get_all_values("Autocrypt-Gossip");
429-
gossiped_keys = update_gossip_peerstates(
430-
context,
431-
timestamp_sent,
432-
&from.addr,
433-
&recipients,
434-
gossip_headers,
435-
)
436-
.await?;
437424
// Remove unsigned opportunistically protected headers from messages considered
438425
// Autocrypt-encrypted / displayed with padlock.
439426
// For "Subject" see <https://github.com/deltachat/deltachat-core-rust/issues/1790>.
@@ -474,6 +461,22 @@ impl MimeMessage {
474461
&mail.headers,
475462
);
476463

464+
if !signatures.is_empty() {
465+
// Handle any gossip headers if the mail was encrypted. See section
466+
// "3.6 Key Gossip" of <https://autocrypt.org/autocrypt-spec-1.1.0.pdf>
467+
// but only if the mail was correctly signed. Probably it's ok to not require
468+
// encryption here, but let's follow the standard.
469+
let gossip_headers = mail.headers.get_all_values("Autocrypt-Gossip");
470+
gossiped_keys = update_gossip_peerstates(
471+
context,
472+
timestamp_sent,
473+
&from.addr,
474+
&recipients,
475+
gossip_headers,
476+
)
477+
.await?;
478+
}
479+
477480
if let Some(inner_from) = inner_from {
478481
if !addr_cmp(&inner_from.addr, &from.addr) {
479482
// There is a From: header in the encrypted

0 commit comments

Comments
 (0)