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

make one-to-one chats read-only the first seconds of a secure-join #5512

Closed
r10s opened this issue Apr 30, 2024 · 6 comments
Closed

make one-to-one chats read-only the first seconds of a secure-join #5512

r10s opened this issue Apr 30, 2024 · 6 comments
Assignees

Comments

@r10s
Copy link
Member

r10s commented Apr 30, 2024

this issue is the outcome of the discussion at #5475: protecting Bob (the joiner) of sending unexpected-unencrypted messages during an otherwise nicely running secure-join.

if things get stuck, however, we do not want to block communication - the chat is just opportunistic as usual, but that needs to be communicated:

  1. If Bob's chat with Alice has no messages yet, securejoin is started, and Bob doesn't have Alice's key:
    add info-message Establishing guaranteed e2ee, please wait... and let chat_can_send() return false

  2. once the info-message Messages are guaranteed to be e2ee from now on is added, let chat_can_send() return true

  3. if after TIMEOUT seconds 2. did not happen, add another info-message Could not yet establish guaranteed e2ee but you may already send a message without 1 and also let chat_can_send() return true

both, 2. and 3. require the event DC_EVENT_CHAT_MODIFIED being sent out so that UI pick up the change wrt chat_can_send() (this is the same way how groups become updated wrt can-send-changes)

The TIMEOUT should be 10-20 seconds so that we are reasonably sure that the app remains active and receiving also on mobile devices.
If the app is killed during this time then we may need to do step 3 for any pending bob-join chats (right now, bob can only
join one chat at a time, see #2777)

this issue only affects one-to-one chats only - groups already have can_send() set to false until secure join is finished.

idea of this approach is to not clutter UI unnecessarily and to not add additional work to UI.

Footnotes

  1. to the exact wording can be refined later, it is mainly to get the flow right for now. at let UI know that a secure-join is ongoing #5475 there was also the suggestion to have different texts for "key there" and "key not there", saying that message may or may not be encrypted, however, that seems tricky as the chat is opportunistic, things may change at any time, so i left that out; but once the flow is there, this can also be refined easily

@adbenitez
Copy link
Member

I think showing a chat without the possibility to send is a bit weird for a 1:1 chat, oth if you let the user type, user might just be drafting a message and never even realize there was a time they couldn't send, often the case when user sends unencrypted messages, anyway, is when the verification took more than "some seconds", so I am not 100% sure how useful this is, another option would be to retain the sent message in "pending" state for some more seconds if there is a verification in progress

@r10s
Copy link
Member Author

r10s commented May 2, 2024

I think showing a chat without the possibility to send is a bit weird for a 1:1 chat

in practise, it is often only for ~1 seconds, so, user would not even notice that there was a delay while reading the info-message :)

we're doing this for group-joins since "forever",even without timeout

but yeah, there are other possibilities around and were discussed also at #5512, but the approach from above does not require UI (and not esp. in the draft area which is sensible anyways on all platforms) and was regarded as a good+easy start. we can iterate always if this approach turns out to be annoying.

and: also for other approaches we would add the info-messages, some feedback similar to groups just make sense anyways, so large parts of this idea are needed anyways

@iequidoo
Copy link
Collaborator

iequidoo commented May 3, 2024

another option would be to retain the sent message in "pending" state for some more seconds if there is a verification in progress

Btw, this option wasn't discussed in #5475 and it also doesn't require UI changes. In fact it implies even less info messages, e.g. "Establishing guaranteed e2ee, please wait..." isn't needed. And the user can draft and send messages w/o any delay. And an extra DC_EVENT_CHAT_MODIFIED isn't needed.

@r10s
Copy link
Member Author

r10s commented May 3, 2024

if we retain messages if verification is in progress, this is no guarantee, that verification succeeds

so what to do then without additional ui? we probably again have the situation of unexpected unsent or unexpected unencrypted

maybe the latter is acceptable, idk, at least it will be better than current state - but i also think ppl will continue complaining, so the issue is not closed

for the info messages: we want them in any case to have feedback as for groups

all in all, i still think, hiding-sent is the easier and more comprehensive way to move forward to have a solution in a few days for 1.46. we can always iterate on that as needed

@iequidoo
Copy link
Collaborator

iequidoo commented May 3, 2024

Btw, allowing the user to send messages immediately creates a race condition: even if we don't send messages sent by the user before timeout unencrypted, but fail sending instead, we start to send new messages unencrypted after timeout (even if we warn the user with some system message), so the user doesn't really know if the message will go encrypted. So, we must warn the user from the very beginning that messages may go unencrypted. But then i'm not sure it's very useful, probably most of users would prefer to wait for guaranteed e2ee anyway. At least the current solution gives more protection from unexpected behaviour.

@iequidoo iequidoo self-assigned this May 7, 2024
iequidoo added a commit that referenced this issue May 11, 2024
…in (#5512)

This protects Bob (the joiner) of sending unexpected-unencrypted messages during an otherwise nicely
running SecureJoin.

If things get stuck, however, we do not want to block communication -- the chat is just
opportunistic as usual, but that needs to be communicated:
1. If Bob's chat with Alice is `Unprotected` and a SecureJoin is started, then add info-message
   "Establishing guaranteed end-to-end encryption, please wait..." and let `Chat::can_send()` return
   `false`.
2. Once the info-message "Messages are guaranteed to be e2ee from now on" is added, let
   `Chat::can_send()` return `true`.
3. If after SECUREJOIN_WAIT_TIMEOUT seconds `2.` did not happen, add another info-message "Could not
   yet establish guaranteed end-to-end encryption but you may already send a message" and also let
   `Chat::can_send()` return `true`.

Both `2.` and `3.` require the event `ChatModified` being sent out so that UI pick up the change wrt
`Chat::can_send()` (this is the same way how groups become updated wrt `can_send()` changes).

SECUREJOIN_WAIT_TIMEOUT should be 10-20 seconds so that we are reasonably sure that the app remains
active and receiving also on mobile devices. If the app is killed during this time then we may need
to do step 3 for any pending Bob-join chats (right now, Bob can only join one chat at a time).
iequidoo added a commit that referenced this issue May 11, 2024
…in (#5512)

This protects Bob (the joiner) of sending unexpected-unencrypted messages during an otherwise nicely
running SecureJoin.

If things get stuck, however, we do not want to block communication -- the chat is just
opportunistic as usual, but that needs to be communicated:
1. If Bob's chat with Alice is `Unprotected` and a SecureJoin is started, then add info-message
   "Establishing guaranteed end-to-end encryption, please wait..." and let `Chat::can_send()` return
   `false`.
2. Once the info-message "Messages are guaranteed to be e2ee from now on" is added, let
   `Chat::can_send()` return `true`.
3. If after SECUREJOIN_WAIT_TIMEOUT seconds `2.` did not happen, add another info-message "Could not
   yet establish guaranteed end-to-end encryption but you may already send a message" and also let
   `Chat::can_send()` return `true`.

Both `2.` and `3.` require the event `ChatModified` being sent out so that UI pick up the change wrt
`Chat::can_send()` (this is the same way how groups become updated wrt `can_send()` changes).

SECUREJOIN_WAIT_TIMEOUT should be 10-20 seconds so that we are reasonably sure that the app remains
active and receiving also on mobile devices. If the app is killed during this time then we may need
to do step 3 for any pending Bob-join chats (right now, Bob can only join one chat at a time).
iequidoo added a commit that referenced this issue May 11, 2024
…in (#5512)

This protects Bob (the joiner) of sending unexpected-unencrypted messages during an otherwise nicely
running SecureJoin.

If things get stuck, however, we do not want to block communication -- the chat is just
opportunistic as usual, but that needs to be communicated:
1. If Bob's chat with Alice is `Unprotected` and a SecureJoin is started, then add info-message
   "Establishing guaranteed end-to-end encryption, please wait..." and let `Chat::can_send()` return
   `false`.
2. Once the info-message "Messages are guaranteed to be e2ee from now on" is added, let
   `Chat::can_send()` return `true`.
3. If after SECUREJOIN_WAIT_TIMEOUT seconds `2.` did not happen, add another info-message "Could not
   yet establish guaranteed end-to-end encryption but you may already send a message" and also let
   `Chat::can_send()` return `true`.

Both `2.` and `3.` require the event `ChatModified` being sent out so that UI pick up the change wrt
`Chat::can_send()` (this is the same way how groups become updated wrt `can_send()` changes).

SECUREJOIN_WAIT_TIMEOUT should be 10-20 seconds so that we are reasonably sure that the app remains
active and receiving also on mobile devices. If the app is killed during this time then we may need
to do step 3 for any pending Bob-join chats (right now, Bob can only join one chat at a time).
r10s pushed a commit that referenced this issue May 13, 2024
…in (#5512)

This protects Bob (the joiner) of sending unexpected-unencrypted messages during an otherwise nicely
running SecureJoin.

If things get stuck, however, we do not want to block communication -- the chat is just
opportunistic as usual, but that needs to be communicated:
1. If Bob's chat with Alice is `Unprotected` and a SecureJoin is started, then add info-message
   "Establishing guaranteed end-to-end encryption, please wait..." and let `Chat::can_send()` return
   `false`.
2. Once the info-message "Messages are guaranteed to be e2ee from now on" is added, let
   `Chat::can_send()` return `true`.
3. If after SECUREJOIN_WAIT_TIMEOUT seconds `2.` did not happen, add another info-message "Could not
   yet establish guaranteed end-to-end encryption but you may already send a message" and also let
   `Chat::can_send()` return `true`.

Both `2.` and `3.` require the event `ChatModified` being sent out so that UI pick up the change wrt
`Chat::can_send()` (this is the same way how groups become updated wrt `can_send()` changes).

SECUREJOIN_WAIT_TIMEOUT should be 10-20 seconds so that we are reasonably sure that the app remains
active and receiving also on mobile devices. If the app is killed during this time then we may need
to do step 3 for any pending Bob-join chats (right now, Bob can only join one chat at a time).
@r10s
Copy link
Member Author

r10s commented May 13, 2024

closed by #5550

@r10s r10s closed this as completed May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants