Skip to content

feat: hide the To header in encrypted messages #6649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/chat/chat_tests.rs
Original file line number Diff line number Diff line change
@@ -790,15 +790,6 @@ async fn test_self_talk() -> Result<()> {
assert!(msg.get_showpadlock());

let sent_msg = t.pop_sent_msg().await;
let payload = sent_msg.payload();
// Make sure the `To` field contains the address and not
// "undisclosed recipients".
// Otherwise Delta Chat core <1.153.0 assigns the message
// to the trash chat.
assert_eq!(
payload.match_indices("To: <alice@example.org>\r\n").count(),
1
);

let t2 = TestContext::new_alice().await;
t2.recv_msg(&sent_msg).await;
21 changes: 2 additions & 19 deletions src/mimefactory.rs
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ use anyhow::{bail, Context as _, Result};
use base64::Engine as _;
use chrono::TimeZone;
use deltachat_contact_tools::sanitize_bidi_characters;
use mail_builder::headers::address::{Address, EmailAddress};
use mail_builder::headers::address::Address;
use mail_builder::headers::HeaderType;
use mail_builder::mime::MimePart;
use tokio::fs;
@@ -850,24 +850,7 @@ impl MimeFactory {
} else if header_name == "to" {
protected_headers.push(header.clone());
if is_encrypted {
let mut to_without_names = to
.clone()
.into_iter()
.filter_map(|header| match header {
Address::Address(mb) => Some(Address::Address(EmailAddress {
name: None,
email: mb.email,
})),
_ => None,
})
.collect::<Vec<_>>();
if to_without_names.is_empty() {
to_without_names.push(hidden_recipients());
}
unprotected_headers.push((
original_header_name,
Address::new_list(to_without_names).into(),
));
unprotected_headers.push(("To", hidden_recipients().into()));
} else {
unprotected_headers.push(header.clone());
}