Skip to content

Do not create ad-hoc groups when message cannot be decrypted - #1566

Merged
hpk42 merged 4 commits into
masterfrom
undecipherable-group
Jun 8, 2020
Merged

hpk42 merged 4 commits into
masterfrom
undecipherable-group

Conversation

@link2xt

@link2xt link2xt commented Jun 6, 2020 •

Copy link
Copy Markdown
Collaborator

Trying to reproduce #1565

ac1 establishes keys with ac2 and ac3. Then ac2 is cloned into ac4 with a new key to simulate reinstallation. ac1 creates a group with ac2 and ac3 and sends two messages there.

Received messages have IDs like Gr.YhIUVTlAq0F.…, but ac4 assigns them to a different group ID:

7.47 [events-ac4] DC_EVENT_WARNING data1=0 data2=src/mimeparser.rs:162: decryption failed: missing key
...
7.50 [events-ac4] DC_EVENT_INFO data1=0 data2=src/dc_receive_imf.rs:1348: Created group '...' grpid=96e01a197ee944d4 as Chat#11

@link2xt

link2xt commented Jun 6, 2020

Copy link
Copy Markdown
Collaborator Author

This happens even if ac4 adds ac1 in the contact list first. The message comes from a known account address, yet it is assigned to a group with a completely random ID.

What is worse, when ac3 sends a reply, ac4 creates another group with another random ID. Now it has two groups named ...:

7.62 [events-ac4] DC_EVENT_WARNING data1=0 data2=src/mimeparser.rs:162: decryption failed: missing key
7.65 [events-ac4] DC_EVENT_INFO data1=0 data2=src/dc_receive_imf.rs:1348: Created group '...' grpid=2024c44da630b433 as Chat#11
...
9.81 [events-ac4] DC_EVENT_WARNING data1=0 data2=src/mimeparser.rs:162: decryption failed: missing key
9.81 [events-ac4] DC_EVENT_INFO data1=0 data2=src/dc_receive_imf.rs:1348: Created group '...' grpid=2024c44da630b433 as Chat#12

@link2xt
link2xt force-pushed the undecipherable-group branch from 2c2fe6b to fe80c0d Compare June 8, 2020 05:55
@link2xt link2xt changed the title Add python test for undecipherable ad-hoc group Do not create ad-hoc groups when message cannot be decrypted Jun 8, 2020
@link2xt

link2xt commented Jun 8, 2020

Copy link
Copy Markdown
Collaborator Author

I have updated this PR. There are two commits now.

First commit adds a failing test, in which one user loses the key but keeps receiving messages sent by two other members to a new group.

Second commit fixes the test with a single check. Right before creating ad-hoc group, when memberlist heuristic already failed to find a corresponding group ID, we return 0 chat ID if the message was not decrypted correctly.

Fixes #1565 and maybe #1347

@Hocuri Hocuri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Definitely an improvement!
What happens to the message instead? IMHO it should be shown in the 1:1 chat (Could not decrypt, and so on)

@link2xt

link2xt commented Jun 8, 2020

Copy link
Copy Markdown
Collaborator Author

What happens to the message instead? IMHO it should be shown in the 1:1 chat (Could not decrypt, and so on)

It goes into 1:1 chat, see the test. There are three tests like assert error_msg.chat == get_chat(ac4, ac1) which check that error message is assigned to the corresponding 1:1 chat between ac4 and ac1.

@link2xt
link2xt force-pushed the undecipherable-group branch 2 times, most recently from c2749a5 to eaaa8c2 Compare June 8, 2020 10:14
@link2xt

link2xt commented Jun 8, 2020

Copy link
Copy Markdown
Collaborator Author

Reduced the number of messages exchanged and added a comment to make it easier to review. First commit fails, second commit passes.

The most important thing to review here is the test. :)

Comment thread python/tests/test_account.py Resolved
Comment thread python/tests/test_account.py Resolved
Comment thread python/tests/test_account.py Resolved
Comment thread python/tests/test_account.py Resolved
Comment thread python/tests/test_account.py Resolved

@hpk42 hpk42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

other than the comments looks good to me.

@link2xt link2xt changed the title Do not create ad-hoc groups when message cannot be decrypted WIP: Do not create ad-hoc groups when message cannot be decrypted Jun 8, 2020
@link2xt
link2xt force-pushed the undecipherable-group branch from eaaa8c2 to 335c81b Compare June 8, 2020 17:53
@link2xt

link2xt commented Jun 8, 2020

Copy link
Copy Markdown
Collaborator Author

Marking as WIP because I want to test one more thing: what happens when ac4 replies to these error messages. The reply-to field contains group message-ID in this case, so on ac1 and ac2 the reply is assigned to group chat, even though ac4 sent it to 1:1 chat.

Message parent selection needs update too.

Reply to group messages assigned to 1:1 chat on ac4 and see where they
end up on ac1 and ac2. Currently they contain group ID in Reply-To field
and go to group chat, so the test is failing.
@link2xt
link2xt force-pushed the undecipherable-group branch from 335c81b to d39a389 Compare June 8, 2020 20:23
@link2xt link2xt changed the title WIP: Do not create ad-hoc groups when message cannot be decrypted Do not create ad-hoc groups when message cannot be decrypted Jun 8, 2020
@link2xt
link2xt force-pushed the undecipherable-group branch from d39a389 to 77a9099 Compare June 8, 2020 20:26
This commit fixes the test broken in previous commit.
@link2xt
link2xt force-pushed the undecipherable-group branch from 77a9099 to 04ae2c0 Compare June 8, 2020 20:29
@hpk42
hpk42 merged commit 7de23f8 into master Jun 8, 2020
@hpk42
hpk42 deleted the undecipherable-group branch June 8, 2020 21:16
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