feat: Don't copy References and In-Reply-To to outer headers

This implements the suggestion from
https://www.rfc-editor.org/rfc/rfc9788.html#name-offering-more-ambitious-hea of "Header Protection
for Cryptographically Protected Email".
This commit is contained in:
iequidoo
2025-11-10 14:02:28 -03:00
parent 8c09ca3691
commit 88fae8b813
3 changed files with 6 additions and 15 deletions

View File

@@ -1062,7 +1062,7 @@ impl MimeFactory {
mail_builder::headers::raw::Raw::new("[...]").into(),
));
}
"in-reply-to" | "references" | "autocrypt-setup-message" => {
"autocrypt-setup-message" => {
unprotected_headers.push(header.clone());
}
_ => {

View File

@@ -4849,14 +4849,15 @@ async fn test_prefer_references_to_downloaded_msgs() -> Result<()> {
let received = bob.recv_msg(&sent).await;
assert_eq!(received.download_state, DownloadState::Available);
assert_ne!(received.chat_id, bob_chat_id);
assert_eq!(received.chat_id, bob.get_chat(alice).await.id);
let bob_alice_chat_id = bob.get_chat(alice).await.id;
assert_eq!(received.chat_id, bob_alice_chat_id);
let mut msg = Message::new(Viewtype::File);
msg.set_file_from_bytes(alice, "file", file_bytes, None)?;
let sent = alice.send_msg(alice_chat_id, &mut msg).await;
let received = bob.recv_msg(&sent).await;
assert_eq!(received.download_state, DownloadState::Available);
assert_eq!(received.chat_id, bob_chat_id);
assert_eq!(received.chat_id, bob_alice_chat_id);
Ok(())
}