mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
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.
This commit is contained in:
@@ -1062,7 +1062,7 @@ impl MimeFactory {
|
||||
mail_builder::headers::raw::Raw::new("[...]").into(),
|
||||
));
|
||||
}
|
||||
"in-reply-to" | "references" | "auto-submitted" | "autocrypt-setup-message" => {
|
||||
"in-reply-to" | "references" | "autocrypt-setup-message" => {
|
||||
unprotected_headers.push(header.clone());
|
||||
}
|
||||
_ => {
|
||||
|
||||
@@ -60,13 +60,13 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
||||
bob.set_config(Config::Displayname, Some("Bob Examplenet"))
|
||||
.await
|
||||
.unwrap();
|
||||
let alice_auto_submitted_hdr;
|
||||
let alice_auto_submitted_val;
|
||||
match case {
|
||||
SetupContactCase::AliceIsBot => {
|
||||
alice.set_config_bool(Config::Bot, true).await.unwrap();
|
||||
alice_auto_submitted_hdr = "Auto-Submitted: auto-generated";
|
||||
alice_auto_submitted_val = "auto-generated";
|
||||
}
|
||||
_ => alice_auto_submitted_hdr = "Auto-Submitted: auto-replied",
|
||||
_ => alice_auto_submitted_val = "auto-replied",
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
@@ -121,7 +121,7 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
||||
);
|
||||
|
||||
let sent = alice.pop_sent_msg().await;
|
||||
assert!(sent.payload.contains(alice_auto_submitted_hdr));
|
||||
assert!(!sent.payload.contains("Auto-Submitted:"));
|
||||
assert!(!sent.payload.contains("Alice Exampleorg"));
|
||||
let msg = bob.parse_msg(&sent).await;
|
||||
assert!(msg.was_encrypted());
|
||||
@@ -129,6 +129,10 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
||||
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
||||
"vc-auth-required"
|
||||
);
|
||||
assert_eq!(
|
||||
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
|
||||
alice_auto_submitted_val
|
||||
);
|
||||
|
||||
let bob_chat = bob.get_chat(&alice).await;
|
||||
assert_eq!(bob_chat.can_send(&bob).await.unwrap(), true);
|
||||
@@ -157,7 +161,7 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
||||
|
||||
// Check Bob sent the right message.
|
||||
let sent = bob.pop_sent_msg().await;
|
||||
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
|
||||
assert!(!sent.payload.contains("Auto-Submitted:"));
|
||||
assert!(!sent.payload.contains("Bob Examplenet"));
|
||||
let mut msg = alice.parse_msg(&sent).await;
|
||||
assert!(msg.was_encrypted());
|
||||
@@ -171,6 +175,10 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
||||
msg.get_header(HeaderDef::SecureJoinFingerprint).unwrap(),
|
||||
bob_fp
|
||||
);
|
||||
assert_eq!(
|
||||
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
|
||||
"auto-replied"
|
||||
);
|
||||
|
||||
if case == SetupContactCase::WrongAliceGossip {
|
||||
let wrong_pubkey = GossipedKey {
|
||||
@@ -248,7 +256,7 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
||||
|
||||
// Check Alice sent the right message to Bob.
|
||||
let sent = alice.pop_sent_msg().await;
|
||||
assert!(sent.payload.contains(alice_auto_submitted_hdr));
|
||||
assert!(!sent.payload.contains("Auto-Submitted:"));
|
||||
assert!(!sent.payload.contains("Alice Exampleorg"));
|
||||
let msg = bob.parse_msg(&sent).await;
|
||||
assert!(msg.was_encrypted());
|
||||
@@ -256,6 +264,10 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
||||
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
||||
"vc-contact-confirm"
|
||||
);
|
||||
assert_eq!(
|
||||
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
|
||||
alice_auto_submitted_val
|
||||
);
|
||||
|
||||
// Bob has verified Alice already.
|
||||
//
|
||||
@@ -465,13 +477,17 @@ async fn test_secure_join() -> Result<()> {
|
||||
alice.recv_msg_trash(&sent).await;
|
||||
|
||||
let sent = alice.pop_sent_msg().await;
|
||||
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
|
||||
assert!(!sent.payload.contains("Auto-Submitted:"));
|
||||
let msg = bob.parse_msg(&sent).await;
|
||||
assert!(msg.was_encrypted());
|
||||
assert_eq!(
|
||||
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
||||
"vg-auth-required"
|
||||
);
|
||||
assert_eq!(
|
||||
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
|
||||
"auto-replied"
|
||||
);
|
||||
|
||||
tcm.section("Step 4: Bob receives vg-auth-required, sends vg-request-with-auth");
|
||||
bob.recv_msg_trash(&sent).await;
|
||||
@@ -503,7 +519,7 @@ async fn test_secure_join() -> Result<()> {
|
||||
}
|
||||
|
||||
// Check Bob sent the right handshake message.
|
||||
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
|
||||
assert!(!sent.payload.contains("Auto-Submitted:"));
|
||||
let msg = alice.parse_msg(&sent).await;
|
||||
assert!(msg.was_encrypted());
|
||||
assert_eq!(
|
||||
@@ -516,6 +532,10 @@ async fn test_secure_join() -> Result<()> {
|
||||
msg.get_header(HeaderDef::SecureJoinFingerprint).unwrap(),
|
||||
bob_fp
|
||||
);
|
||||
assert_eq!(
|
||||
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
|
||||
"auto-replied"
|
||||
);
|
||||
|
||||
// Alice should not yet have Bob verified
|
||||
let contact_bob = alice.add_or_lookup_contact_no_key(&bob).await;
|
||||
|
||||
Reference in New Issue
Block a user