Skip to content

Commit 88fae8b

Browse files
committed
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".
1 parent 8c09ca3 commit 88fae8b

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

deltachat-rpc-client/tests/test_something.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -660,14 +660,12 @@ def test_download_limit_chat_assignment(acfactory, tmp_path, n_accounts):
660660
contact = alice.create_contact(account)
661661
alice_group.add_contact(contact)
662662

663-
if n_accounts == 2:
664-
bob_chat_alice = bob.create_chat(alice)
663+
bob_chat_alice = bob.create_chat(alice)
665664
bob.set_config("download_limit", str(download_limit))
666665

667666
alice_group.send_text("hi")
668667
snapshot = bob.wait_for_incoming_msg().get_snapshot()
669668
assert snapshot.text == "hi"
670-
bob_group = snapshot.chat
671669

672670
path = tmp_path / "large"
673671
path.write_bytes(os.urandom(download_limit + 1))
@@ -677,15 +675,7 @@ def test_download_limit_chat_assignment(acfactory, tmp_path, n_accounts):
677675
alice_group.send_file(str(path))
678676
snapshot = bob.wait_for_incoming_msg().get_snapshot()
679677
assert snapshot.download_state == DownloadState.AVAILABLE
680-
if n_accounts > 2:
681-
assert snapshot.chat == bob_group
682-
else:
683-
# Group contains only Alice and Bob,
684-
# so partially downloaded messages are
685-
# hard to distinguish from private replies to group messages.
686-
#
687-
# Message may be a private reply, so we assign it to 1:1 chat with Alice.
688-
assert snapshot.chat == bob_chat_alice
678+
assert snapshot.chat == bob_chat_alice
689679

690680

691681
def test_markseen_contact_request(acfactory):

src/mimefactory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ impl MimeFactory {
10621062
mail_builder::headers::raw::Raw::new("[...]").into(),
10631063
));
10641064
}
1065-
"in-reply-to" | "references" | "autocrypt-setup-message" => {
1065+
"autocrypt-setup-message" => {
10661066
unprotected_headers.push(header.clone());
10671067
}
10681068
_ => {

src/receive_imf/receive_imf_tests.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4849,14 +4849,15 @@ async fn test_prefer_references_to_downloaded_msgs() -> Result<()> {
48494849
let received = bob.recv_msg(&sent).await;
48504850
assert_eq!(received.download_state, DownloadState::Available);
48514851
assert_ne!(received.chat_id, bob_chat_id);
4852-
assert_eq!(received.chat_id, bob.get_chat(alice).await.id);
4852+
let bob_alice_chat_id = bob.get_chat(alice).await.id;
4853+
assert_eq!(received.chat_id, bob_alice_chat_id);
48534854

48544855
let mut msg = Message::new(Viewtype::File);
48554856
msg.set_file_from_bytes(alice, "file", file_bytes, None)?;
48564857
let sent = alice.send_msg(alice_chat_id, &mut msg).await;
48574858
let received = bob.recv_msg(&sent).await;
48584859
assert_eq!(received.download_state, DownloadState::Available);
4859-
assert_eq!(received.chat_id, bob_chat_id);
4860+
assert_eq!(received.chat_id, bob_alice_chat_id);
48604861

48614862
Ok(())
48624863
}

0 commit comments

Comments
 (0)