mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 13:26:28 +03:00
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:
@@ -660,14 +660,12 @@ def test_download_limit_chat_assignment(acfactory, tmp_path, n_accounts):
|
|||||||
contact = alice.create_contact(account)
|
contact = alice.create_contact(account)
|
||||||
alice_group.add_contact(contact)
|
alice_group.add_contact(contact)
|
||||||
|
|
||||||
if n_accounts == 2:
|
bob_chat_alice = bob.create_chat(alice)
|
||||||
bob_chat_alice = bob.create_chat(alice)
|
|
||||||
bob.set_config("download_limit", str(download_limit))
|
bob.set_config("download_limit", str(download_limit))
|
||||||
|
|
||||||
alice_group.send_text("hi")
|
alice_group.send_text("hi")
|
||||||
snapshot = bob.wait_for_incoming_msg().get_snapshot()
|
snapshot = bob.wait_for_incoming_msg().get_snapshot()
|
||||||
assert snapshot.text == "hi"
|
assert snapshot.text == "hi"
|
||||||
bob_group = snapshot.chat
|
|
||||||
|
|
||||||
path = tmp_path / "large"
|
path = tmp_path / "large"
|
||||||
path.write_bytes(os.urandom(download_limit + 1))
|
path.write_bytes(os.urandom(download_limit + 1))
|
||||||
@@ -677,15 +675,7 @@ def test_download_limit_chat_assignment(acfactory, tmp_path, n_accounts):
|
|||||||
alice_group.send_file(str(path))
|
alice_group.send_file(str(path))
|
||||||
snapshot = bob.wait_for_incoming_msg().get_snapshot()
|
snapshot = bob.wait_for_incoming_msg().get_snapshot()
|
||||||
assert snapshot.download_state == DownloadState.AVAILABLE
|
assert snapshot.download_state == DownloadState.AVAILABLE
|
||||||
if n_accounts > 2:
|
assert snapshot.chat == bob_chat_alice
|
||||||
assert snapshot.chat == bob_group
|
|
||||||
else:
|
|
||||||
# Group contains only Alice and Bob,
|
|
||||||
# so partially downloaded messages are
|
|
||||||
# hard to distinguish from private replies to group messages.
|
|
||||||
#
|
|
||||||
# Message may be a private reply, so we assign it to 1:1 chat with Alice.
|
|
||||||
assert snapshot.chat == bob_chat_alice
|
|
||||||
|
|
||||||
|
|
||||||
def test_markseen_contact_request(acfactory):
|
def test_markseen_contact_request(acfactory):
|
||||||
|
|||||||
@@ -1062,7 +1062,7 @@ impl MimeFactory {
|
|||||||
mail_builder::headers::raw::Raw::new("[...]").into(),
|
mail_builder::headers::raw::Raw::new("[...]").into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
"in-reply-to" | "references" | "autocrypt-setup-message" => {
|
"autocrypt-setup-message" => {
|
||||||
unprotected_headers.push(header.clone());
|
unprotected_headers.push(header.clone());
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
@@ -4849,14 +4849,15 @@ async fn test_prefer_references_to_downloaded_msgs() -> Result<()> {
|
|||||||
let received = bob.recv_msg(&sent).await;
|
let received = bob.recv_msg(&sent).await;
|
||||||
assert_eq!(received.download_state, DownloadState::Available);
|
assert_eq!(received.download_state, DownloadState::Available);
|
||||||
assert_ne!(received.chat_id, bob_chat_id);
|
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);
|
let mut msg = Message::new(Viewtype::File);
|
||||||
msg.set_file_from_bytes(alice, "file", file_bytes, None)?;
|
msg.set_file_from_bytes(alice, "file", file_bytes, None)?;
|
||||||
let sent = alice.send_msg(alice_chat_id, &mut msg).await;
|
let sent = alice.send_msg(alice_chat_id, &mut msg).await;
|
||||||
let received = bob.recv_msg(&sent).await;
|
let received = bob.recv_msg(&sent).await;
|
||||||
assert_eq!(received.download_state, DownloadState::Available);
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user