Skip to content

Commit 267026b

Browse files
committed
feat: Do not copy Auto-Submitted header into outer part
Before, copying Auto-Submitted to the outer headers was needed for moving such messages, e.g. multi-device sync messages, to the DeltaChat folder. Now all encrypted messages are moved.
1 parent 22da92c commit 267026b

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

src/mimefactory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ impl MimeFactory {
10621062
mail_builder::headers::raw::Raw::new("[...]").into(),
10631063
));
10641064
}
1065-
"in-reply-to" | "references" | "auto-submitted" | "autocrypt-setup-message" => {
1065+
"in-reply-to" | "references" | "autocrypt-setup-message" => {
10661066
unprotected_headers.push(header.clone());
10671067
}
10681068
_ => {

src/securejoin/securejoin_tests.rs

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
6060
bob.set_config(Config::Displayname, Some("Bob Examplenet"))
6161
.await
6262
.unwrap();
63-
let alice_auto_submitted_hdr;
63+
let alice_auto_submitted_val;
6464
match case {
6565
SetupContactCase::AliceIsBot => {
6666
alice.set_config_bool(Config::Bot, true).await.unwrap();
67-
alice_auto_submitted_hdr = "Auto-Submitted: auto-generated";
67+
alice_auto_submitted_val = "auto-generated";
6868
}
69-
_ => alice_auto_submitted_hdr = "Auto-Submitted: auto-replied",
69+
_ => alice_auto_submitted_val = "auto-replied",
7070
};
7171

7272
assert_eq!(
@@ -121,14 +121,18 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
121121
);
122122

123123
let sent = alice.pop_sent_msg().await;
124-
assert!(sent.payload.contains(alice_auto_submitted_hdr));
124+
assert!(!sent.payload.contains("Auto-Submitted:"));
125125
assert!(!sent.payload.contains("Alice Exampleorg"));
126126
let msg = bob.parse_msg(&sent).await;
127127
assert!(msg.was_encrypted());
128128
assert_eq!(
129129
msg.get_header(HeaderDef::SecureJoin).unwrap(),
130130
"vc-auth-required"
131131
);
132+
assert_eq!(
133+
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
134+
alice_auto_submitted_val
135+
);
132136

133137
let bob_chat = bob.get_chat(&alice).await;
134138
assert_eq!(bob_chat.can_send(&bob).await.unwrap(), true);
@@ -157,7 +161,7 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
157161

158162
// Check Bob sent the right message.
159163
let sent = bob.pop_sent_msg().await;
160-
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
164+
assert!(!sent.payload.contains("Auto-Submitted:"));
161165
assert!(!sent.payload.contains("Bob Examplenet"));
162166
let mut msg = alice.parse_msg(&sent).await;
163167
assert!(msg.was_encrypted());
@@ -171,6 +175,10 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
171175
msg.get_header(HeaderDef::SecureJoinFingerprint).unwrap(),
172176
bob_fp
173177
);
178+
assert_eq!(
179+
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
180+
"auto-replied"
181+
);
174182

175183
if case == SetupContactCase::WrongAliceGossip {
176184
let wrong_pubkey = GossipedKey {
@@ -248,14 +256,18 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
248256

249257
// Check Alice sent the right message to Bob.
250258
let sent = alice.pop_sent_msg().await;
251-
assert!(sent.payload.contains(alice_auto_submitted_hdr));
259+
assert!(!sent.payload.contains("Auto-Submitted:"));
252260
assert!(!sent.payload.contains("Alice Exampleorg"));
253261
let msg = bob.parse_msg(&sent).await;
254262
assert!(msg.was_encrypted());
255263
assert_eq!(
256264
msg.get_header(HeaderDef::SecureJoin).unwrap(),
257265
"vc-contact-confirm"
258266
);
267+
assert_eq!(
268+
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
269+
alice_auto_submitted_val
270+
);
259271

260272
// Bob has verified Alice already.
261273
//
@@ -465,13 +477,17 @@ async fn test_secure_join() -> Result<()> {
465477
alice.recv_msg_trash(&sent).await;
466478

467479
let sent = alice.pop_sent_msg().await;
468-
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
480+
assert!(!sent.payload.contains("Auto-Submitted:"));
469481
let msg = bob.parse_msg(&sent).await;
470482
assert!(msg.was_encrypted());
471483
assert_eq!(
472484
msg.get_header(HeaderDef::SecureJoin).unwrap(),
473485
"vg-auth-required"
474486
);
487+
assert_eq!(
488+
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
489+
"auto-replied"
490+
);
475491

476492
tcm.section("Step 4: Bob receives vg-auth-required, sends vg-request-with-auth");
477493
bob.recv_msg_trash(&sent).await;
@@ -503,7 +519,7 @@ async fn test_secure_join() -> Result<()> {
503519
}
504520

505521
// Check Bob sent the right handshake message.
506-
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
522+
assert!(!sent.payload.contains("Auto-Submitted:"));
507523
let msg = alice.parse_msg(&sent).await;
508524
assert!(msg.was_encrypted());
509525
assert_eq!(
@@ -516,6 +532,10 @@ async fn test_secure_join() -> Result<()> {
516532
msg.get_header(HeaderDef::SecureJoinFingerprint).unwrap(),
517533
bob_fp
518534
);
535+
assert_eq!(
536+
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
537+
"auto-replied"
538+
);
519539

520540
// Alice should not yet have Bob verified
521541
let contact_bob = alice.add_or_lookup_contact_no_key(&bob).await;

0 commit comments

Comments
 (0)