Skip to content
Draft
Show file tree
Hide file tree
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
6 changes: 0 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,6 @@ pub enum Config {
/// Make all outgoing messages with Autocrypt header "multipart/signed".
SignUnencrypted,

/// Enable header protection for `Autocrypt` header.
///
/// This is an experimental setting not compatible to other MUAs
/// and older Delta Chat versions (core version <= v1.149.0).
ProtectAutocrypt,

/// Let the core save all events to the database.
/// This value is used internally to remember the MsgId of the logging xdc
#[strum(props(default = "0"))]
Expand Down
6 changes: 0 additions & 6 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,12 +1033,6 @@ impl Context {
.await?
.to_string(),
);
res.insert(
"protect_autocrypt",
self.get_config_int(Config::ProtectAutocrypt)
.await?
.to_string(),
);
res.insert(
"debug_logging",
self.get_config_int(Config::DebugLogging).await?.to_string(),
Expand Down
4 changes: 0 additions & 4 deletions src/mimefactory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,10 +967,6 @@ impl MimeFactory {
hidden_headers.push(header.clone());
} else if is_hidden(&header_name) {
hidden_headers.push(header.clone());
} else if header_name == "autocrypt"
&& !context.get_config_bool(Config::ProtectAutocrypt).await?
{
unprotected_headers.push(header.clone());
} else if header_name == "from" {
// Unencrypted securejoin messages should _not_ include the display name:
if is_encrypted || !is_securejoin_message {
Expand Down
4 changes: 2 additions & 2 deletions src/mimefactory/mimefactory_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ async fn test_selfavatar_unencrypted_signed() {
assert_eq!(part.match_indices("From:").count(), 1);
assert_eq!(part.match_indices("Message-ID:").count(), 0);
assert_eq!(part.match_indices("Subject:").count(), 1);
assert_eq!(part.match_indices("Autocrypt:").count(), 0);
assert_eq!(part.match_indices("Autocrypt:").count(), 1);
assert_eq!(part.match_indices("Chat-User-Avatar:").count(), 0);

let part = payload.next().unwrap();
Expand Down Expand Up @@ -714,7 +714,7 @@ async fn test_selfavatar_unencrypted_signed() {
assert_eq!(part.match_indices("From:").count(), 1);
assert_eq!(part.match_indices("Message-ID:").count(), 0);
assert_eq!(part.match_indices("Subject:").count(), 1);
assert_eq!(part.match_indices("Autocrypt:").count(), 0);
assert_eq!(part.match_indices("Autocrypt:").count(), 1);
assert_eq!(part.match_indices("Chat-User-Avatar:").count(), 0);

let part = payload.next().unwrap();
Expand Down
33 changes: 0 additions & 33 deletions src/mimeparser/mimeparser_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1819,39 +1819,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.
///
Expand Down
8 changes: 5 additions & 3 deletions src/tests/aeap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,12 @@ async fn test_aeap_replay_attack() -> Result<()> {
// Fiona gets the message, replaces the From addr...
let sent = sent
.payload()
.replace("From: <[email protected]>", "From: <[email protected]>")
.replace("[email protected];", "[email protected];");
.replace("From: <[email protected]>", "From: <[email protected]>");
sent.find("From: <[email protected]>").unwrap(); // Assert that it worked
sent.find("[email protected];").unwrap(); // Assert that it worked

// Autocrypt header is protected, nothing to replace outside.
// In the signed part we cannot replace it without breaking the signature.
assert!(!sent.contains("[email protected];"));

tcm.section("Fiona replaced the From addr and forwards the message to Bob");
receive_imf(&bob, sent.as_bytes(), false).await?.unwrap();
Expand Down
Loading