feat: do not include provider hostname in Message-ID

It is leaked by anonymous mailing lists,
making it possible to tell which provider the sender is using.
Use `localhost` as the hostname instead.
This commit is contained in:
link2xt
2024-03-19 13:06:56 +00:00
parent 810be4f6c7
commit b34fe8f118
5 changed files with 11 additions and 16 deletions

View File

@@ -289,12 +289,8 @@ pub(crate) fn validate_id(s: &str) -> bool {
/// - this function is called for all outgoing messages.
/// - the message ID should be globally unique
/// - do not add a counter or any private data as this leaks information unnecessarily
pub(crate) fn create_outgoing_rfc724_mid(from_addr: &str) -> String {
let hostname = from_addr
.find('@')
.and_then(|k| from_addr.get(k..))
.unwrap_or("@nohost");
format!("Mr.{}.{}{}", create_id(), create_id(), hostname)
pub(crate) fn create_outgoing_rfc724_mid() -> String {
format!("Mr.{}.{}@localhost", create_id(), create_id())
}
/// Extract the group id (grpid) from a message id (mid)
@@ -1039,9 +1035,9 @@ DKIM Results: Passed=true, Works=true, Allow_Keychange=true";
#[test]
fn test_create_outgoing_rfc724_mid() {
let mid = create_outgoing_rfc724_mid("foo@bar.de");
let mid = create_outgoing_rfc724_mid();
assert!(mid.starts_with("Mr."));
assert!(mid.ends_with("bar.de"));
assert!(mid.ends_with("@localhost"));
assert!(extract_grpid_from_rfc724_mid(mid.as_str()).is_none());
}