feat!: remove passthrough options that allowed unencrypted mail to pass

see https://github.com/chatmail/relay/pull/970/ for the related removal of chatmail.ini options
This commit is contained in:
holger krekel
2026-05-14 20:59:13 +02:00
parent 91d09ab370
commit 664ad571b6
3 changed files with 4 additions and 69 deletions
-32
View File
@@ -131,19 +131,6 @@ pub fn check_encrypted(mail: &mailparse::ParsedMail, outgoing: bool) -> bool {
true
}
/// Check if recipient matches a passthrough pattern
pub fn recipient_matches_passthrough(recipient: &str, passthrough_recipients: &[String]) -> bool {
for addr in passthrough_recipients {
if recipient == addr {
return true;
}
if addr.starts_with('@') && recipient.ends_with(addr) {
return true;
}
}
false
}
#[cfg(test)]
mod tests {
use super::*;
@@ -151,11 +138,6 @@ mod tests {
use rstest::*;
use testresult::TestResult;
#[fixture]
fn passthrough_recipients() -> Vec<String> {
vec!["pass@example.org".to_string(), "@example.com".to_string()]
}
#[rstest]
#[case::asm("test_data/asm.eml", false)]
#[case::encrypted("test_data/encrypted.eml", false)]
@@ -189,18 +171,4 @@ mod tests {
assert_eq!(check_encrypted(&parsed, false), expected);
Ok(())
}
#[rstest]
#[case("pass@example.org", true)]
#[case("other@example.org", false)]
#[case("anything@example.com", true)]
#[case("anything@sub.example.com", false)]
fn test_recipient_matches_passthrough(
#[case] recipient: &str,
#[case] expected: bool,
passthrough_recipients: Vec<String>,
) {
let result = recipient_matches_passthrough(recipient, &passthrough_recipients);
assert_eq!(result, expected);
}
}