Skip to content

Commit 21084c4

Browse files
committed
docs: add a NOTE comment about KeyId backward verification race
1 parent c352a44 commit 21084c4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/receive_imf.rs

+8
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,14 @@ pub(crate) async fn receive_imf_inner(
350350
&& mime_parser.get_header(HeaderDef::ChatVerified).is_some()
351351
{
352352
if let Some(peerstate) = &mut mime_parser.decryption_info.peerstate {
353+
// NOTE: it might be better to remember ID of the key
354+
// that we used to decrypt the message, but
355+
// it is unlikely that default key ever changes
356+
// as it only happens when user imports a new default key.
357+
//
358+
// Backward verification is not security-critical,
359+
// it is only needed to avoid adding user who does not
360+
// have our key as verified to protected chats.
353361
peerstate.backward_verified_key_id =
354362
Some(context.get_config_i64(Config::KeyId).await?).filter(|&id| id > 0);
355363
peerstate.save_to_db(&context.sql).await?;

0 commit comments

Comments
 (0)