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

Securejoin: store bobstate in database instead of context #2920

Merged
merged 1 commit into from
Mar 1, 2022

Conversation

flub
Copy link
Contributor

@flub flub commented Dec 24, 2021

The state bob needs to maintain during a secure-join process when
exchanging messages used to be stored on the context. This means if
the process was killed this state was lost and the securejoin process
would fail. Moving this state into the database should help this.

This still only allows a single securejoin process at a time, this may
be relaxed in the future. For now any previous securejoin process
that was running is killed if a new one is started (this was already
the case).

This can remove some of the complexity around BobState handling: since
the state is in the database we can already make state interactions
transactional and correct. We no longer need the mutex around the
state handling. This means the BobStateHandle construct that was
handling the interactions between always having a valid state and
handling the mutex is no longer needed, resulting in some nice
simplifications.

Part of #2777.

Note that the base of this PR is #2901 to make debugging nicer.

@flub flub requested a review from r10s December 24, 2021 18:36
@flub flub force-pushed the flub/logsink branch 2 times, most recently from d275162 to eecf121 Compare December 28, 2021 22:08
Base automatically changed from flub/logsink to master December 28, 2021 22:29
@flub flub force-pushed the flub/securejoin-bobstate-in-db branch from 347fc2a to 5cb4889 Compare December 28, 2021 22:34
@flub flub force-pushed the flub/securejoin-bobstate-in-db branch 3 times, most recently from 51a124c to 1e8f6e0 Compare January 16, 2022 12:50
@flub flub marked this pull request as ready for review January 16, 2022 12:51
Comment on lines 1235 to 1237
// TODO: Check if Alice has a hidden 1:1 chat in which there is an info message
// saying bob is verified. However currently this is purposefully sent to
// Alice's group chat by commit 3b7b8ea0f1f8b9c9d300388768eed069be59c8be?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@r10s would you like to check which way is really desired here? I think the current implementation shows the "contact verified" message in a group chat for alice. So if she invites 5 people to a group with QR code she'd get 5 verified messages in the group while the 1:1 chat with those 5 people is still hidden and empty. Was that the intention?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And likewise, how should it behave for bob?

Copy link
Contributor

Choose a reason for hiding this comment

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

i think, this is fine.

the intention for both, Alice and Bob, is to avoid creation of currently unneeded chats.

since #2508, for Bob, directly after scanning the group chat is opened and in focus of the user. it makes sense to show all messages there. creating a second one-to-one chat when scanning a group is confusing an not needed.

for Alice, it makes sense to have a similar behavior; also as otherwise Alice's chat list is easily spammed with one-to-one chats of all joiners.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Finally got round to fixing up this bit. I'll rebase and merge later this week.

@flub flub requested a review from link2xt January 16, 2022 13:05
@flub flub force-pushed the flub/securejoin-bobstate-in-db branch from 7750215 to 13159a6 Compare March 1, 2022 21:36
The state bob needs to maintain during a secure-join process when
exchanging messages used to be stored on the context.  This means if
the process was killed this state was lost and the securejoin process
would fail.  Moving this state into the database should help this.

This still only allows a single securejoin process at a time, this may
be relaxed in the future.  For now any previous securejoin process
that was running is killed if a new one is started (this was already
the case).

This can remove some of the complexity around BobState handling: since
the state is in the database we can already make state interactions
transactional and correct.  We no longer need the mutex around the
state handling.  This means the BobStateHandle construct that was
handling the interactions between always having a valid state and
handling the mutex is no longer needed, resulting in some nice
simplifications.

Part of #2777.
@flub flub force-pushed the flub/securejoin-bobstate-in-db branch from 13159a6 to 6365418 Compare March 1, 2022 21:39
@flub flub merged commit ef841b1 into master Mar 1, 2022
@flub flub deleted the flub/securejoin-bobstate-in-db branch March 1, 2022 22:02
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.

3 participants