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:
link2xt
2025-05-30 14:57:20 +00:00
committed by l
parent fd3e48dcb2
commit 32263b4574
2 changed files with 85 additions and 7 deletions

View File

@@ -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,