feat: protect Autocrypt header

This commit is contained in:
link2xt
2025-08-12 22:11:05 +00:00
committed by l
parent 9826c28581
commit 5256013615
6 changed files with 7 additions and 54 deletions

View File

@@ -1817,39 +1817,6 @@ async fn test_take_last_header() {
);
}
async fn test_protect_autocrypt(enabled: bool) -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let chat = alice.create_chat(bob).await;
alice
.set_config_bool(Config::ProtectAutocrypt, enabled)
.await?;
let sent = alice.send_text(chat.id, "Hello!").await;
assert_eq!(sent.payload().contains("Autocrypt: "), !enabled);
let msg = bob.recv_msg(&sent).await;
assert_eq!(msg.get_showpadlock(), true);
Ok(())
}
/// Tests that if `protect_autocrypt` is enabled,
/// `Autocrypt` header does not appear in the outer headers
/// of encrypted messages.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_protect_autocrypt_enabled() -> Result<()> {
test_protect_autocrypt(true).await
}
/// Tests that if `protect_autocrypt` is disabled,
/// `Autocrypt` header appears in the outer headers
/// of encrypted messages.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_protect_autocrypt_false() -> Result<()> {
test_protect_autocrypt(false).await
}
/// Tests that CRLF before MIME boundary
/// is not treated as the part body.
///