mirror of
https://github.com/chatmail/core.git
synced 2026-05-12 03:16:29 +03:00
fix: ignore verification error if the chat is not protected yet
If we receive a message from non-verified contact in a non-protected chat with a Chat-Verified header, there is no need to upgrade the chat to verified and display an error. If it was an attack, an attacker could just not send the Chat-Verified header. Most of the time, however, it is just message reordering.
This commit is contained in:
@@ -2381,12 +2381,17 @@ async fn apply_group_changes(
|
||||
|
||||
if mime_parser.get_header(HeaderDef::ChatVerified).is_some() {
|
||||
if let VerifiedEncryption::NotVerified(err) = verified_encryption {
|
||||
warn!(context, "Verification problem: {err:#}.");
|
||||
let s = format!("{err}. See 'Info' for more details");
|
||||
mime_parser.replace_msg_by_error(&s);
|
||||
}
|
||||
|
||||
if !chat.is_protected() {
|
||||
if chat.is_protected() {
|
||||
warn!(context, "Verification problem: {err:#}.");
|
||||
let s = format!("{err}. See 'Info' for more details");
|
||||
mime_parser.replace_msg_by_error(&s);
|
||||
} else {
|
||||
warn!(
|
||||
context,
|
||||
"Not marking chat {chat_id} as protected due to verification problem: {err:#}."
|
||||
);
|
||||
}
|
||||
} else if !chat.is_protected() {
|
||||
chat_id
|
||||
.set_protection(
|
||||
context,
|
||||
|
||||
Reference in New Issue
Block a user