Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: can_send(): Return false for protected 1:1 chat if contact isn't forward verified (#6222) #6240

Closed
wants to merge 3 commits into from

Conversation

iequidoo
Copy link
Collaborator

@iequidoo iequidoo commented Nov 20, 2024

See commit messages.
Fix #6222
NB: We don't need to move verified_key to public_key for the old peerstate, see Peerstate::peek_key() -- the verified key is never used for encrypting in unverified chats, so even if public_key doesn't exist in the peerstate for some reason, just removing verified_key changes nothing.

@iequidoo iequidoo marked this pull request as ready for review November 20, 2024 23:35
… forward verified (#6222)

Otherwise if the user tries to send a message, that would just fail. `Chat::can_send()` returning
false makes the chat input field unavailable. A protected 1:1 chat with a not forward verified
contact may be a result of AEAP, the user should use the 1:1 chat with the new contact then.
@iequidoo iequidoo force-pushed the iequidoo/cant_send-NoForwardVerification branch from 1411105 to 7e6e085 Compare November 21, 2024 21:15
Comment on lines +1669 to +1681
} else if self.typ == Chattype::Single
&& self.is_protected()
&& match get_chat_contacts(context, self.id).await?.pop() {
Some(contact_id) => {
!Contact::get_by_id(context, contact_id)
.await?
.is_forward_verified(context)
.await?
}
None => false,
}
{
Some(NoForwardVerification)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance: This is adding two database calls for can_send() in protected 1:1 chats which is called at least everytime a chat is opened, depending on the UI implementation it might also be multiple times. I didn't measure the performance impact of this, but I assume that it's too big that we would want to accept it.

#6222 is a super niche bug, and it would be even fine not to fix it at all - no one complained during the two years we have AEAP (probably because no one is using it) and AEAP is bound to be replaced soon. We shouldn't sacrifice performance for that. Personally, thinking about it, I tend to just close #6222 and move it to project resurrection, or do a very minimal PR that just makes things work somewhat nicely - e.g. replace the error message with something the user can make sense of (it's fine if it's not translated, many error messages are not).

@Hocuri
Copy link
Collaborator

Hocuri commented Nov 23, 2024

Agreeing with @r10s's suggestion of moving to project resurrection at #6222 (comment)

@Hocuri Hocuri closed this Nov 23, 2024
@iequidoo
Copy link
Collaborator Author

Agreeing with @r10s's suggestion of moving to project resurrection at #6222 (comment)

Agree, but other two commits (the test and additional check before "unverifying" the old contact) are still useful, will move them to separate PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AEAP makes sending messages to the old 1:1 chat fail
2 participants