Completely disable Autocrypt & Authres-checking for mailing lists (#3765)

* Because both only make problems with mailing lists, it's easiest to just disable them. If we want, we can make them work properly with mailing lists one day and re-enable them, but this needs some further thoughts.

Part of #3701

* Use load_from_db() in more tests

* clippy

* Changelog

* Downgrade warning to info, improve message

* Use lifetimes instead of cloning
This commit is contained in:
Hocuri
2022-12-05 20:00:56 +01:00
committed by GitHub
parent 3743aaa16e
commit fc386f4fa1
8 changed files with 140 additions and 25 deletions

View File

@@ -6,10 +6,11 @@ use anyhow::{Context as _, Result};
use mailparse::ParsedMail;
use crate::aheader::{Aheader, EncryptPreference};
use crate::authres;
use crate::authres::handle_authres;
use crate::authres::{self, DkimResults};
use crate::contact::addr_cmp;
use crate::context::Context;
use crate::headerdef::{HeaderDef, HeaderDefMap};
use crate::key::{DcKey, Fingerprint, SignedPublicKey, SignedSecretKey};
use crate::keyring::Keyring;
use crate::log::LogExt;
@@ -62,6 +63,27 @@ pub(crate) async fn prepare_decryption(
message_time: i64,
is_thunderbird: bool,
) -> Result<DecryptionInfo> {
if mail.headers.get_header(HeaderDef::ListPost).is_some() {
if mail.headers.get_header(HeaderDef::Autocrypt).is_some() {
info!(
context,
"Ignoring autocrypt header since this is a mailing list message. \
NOTE: For privacy reasons, the mailing list software should remove Autocrypt headers."
);
}
return Ok(DecryptionInfo {
from: from.to_string(),
autocrypt_header: None,
peerstate: None,
message_time,
dkim_results: DkimResults {
dkim_passed: false,
dkim_should_work: false,
allow_keychange: true,
},
});
}
let mut autocrypt_header = Aheader::from_headers(from, &mail.headers)
.ok_or_log_msg(context, "Failed to parse Autocrypt header")
.flatten();
@@ -93,7 +115,7 @@ pub(crate) async fn prepare_decryption(
})
}
#[derive(Default, Debug)]
#[derive(Debug)]
pub struct DecryptionInfo {
/// The From address. This is the address from the unnencrypted, outer
/// From header.