+
Skip to content

feat: add "e2ee encrypted" info message to all e2ee chats #7008

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

Merged
merged 20 commits into from
Jul 18, 2025

Conversation

r10s
Copy link
Contributor

@r10s r10s commented Jul 16, 2025

this PR adds a info message "messages are end-to-end-encrypted" also for chats created by eg. vcards. by the removal of lock icons, this is a good place to hint for that in addition; this is also what eg. whatsapp and others are doing

the wording itself is tweaked at deltachat/deltachat-android#3817 (and there is also the rough idea to make the message a little more outstanding, by some more dedicated colors)

did not test in practise, if this leads to double "e2ee info messages" on secure join, tests look good, however. EDIT: did lots of practise tests meanwhile :)

most of the changes in this PR are about test ...

ftr, in another PR, after 2.0 reeases, there could probably quite some code cleanup wrt set-protection, protection-disabled etc.

@r10s r10s changed the title add info message type 'chat e2ee' add "e2ee encrypted" info message to all e2ee chats Jul 16, 2025
@r10s r10s force-pushed the r10s/e2ee-info-message branch from f4de113 to fb965eb Compare July 16, 2025 21:27
@r10s r10s requested review from link2xt and Hocuri July 16, 2025 21:40
@r10s r10s marked this pull request as ready for review July 16, 2025 21:41
@Hocuri
Copy link
Collaborator

Hocuri commented Jul 17, 2025

CI is failing, because python tests need to be adapted to this change.

In case anyone else is wondering: GitHub doesn't show that this is part of the "2.x keycontact releases" in the right pane of this PR, because chatmail/core is not in the deltachat organization.

@r10s
Copy link
Contributor Author

r10s commented Jul 17, 2025

CI is failing, because python tests need to be adapted to this change.

hum, i assume, that there similar adaptions wrt get_msg_cnt() are needed. i am not deep into python, and i do not have a setup where python tests run locally, so it'd be great if someone else can adapt them

@r10s r10s force-pushed the r10s/e2ee-info-message branch from 090ea6b to 5e3b5f9 Compare July 17, 2025 09:07
@Hocuri
Copy link
Collaborator

Hocuri commented Jul 17, 2025

Summary of my review: Some small things, and the problem that this does lead to double "e2ee info messages" on secure join. I can see to repair the tests, but the bigger problem right now are these double messages.

Not sure what the best solution is. Querying whether the previous message is an e2ee info message, and if so, removing it, comes to mind. Generally, we could just modify get_chat_msgs_ex() to statically add an e2ee info message to the top (it already adds daymarkers, so it can also add some info message). But then get_chat_msgs_ex() would have to query for whether there is any protection-enabled message, and if not, add the e2ee info message, not sure about the performance impact of this.

@r10s
Copy link
Contributor Author

r10s commented Jul 18, 2025

yip, the double "messages are end-to-end-encrypted" is bad.

however, the old secure-join-messages also seem outdated - imu, the chat, if is_encrypted() is true, is e2ee from the very beginning on, it makes sense to say that already then, as whatsapp and other are doing - but then we have the flow:

1. "Messages are end to end-encrypted. Tap to learn more."
2. "Establishing end-to-end-encryption..."
3. "Messages are end to end-encrypted. Tap to learn more."

imu, 2. and 3. are no longer related to e2ee-yes-or-not - but are used for getting the keys and/or protecting it against mitm

if so, maybe reword 2. and 3. that would fix the issue.

having these messages as markers seem to be some more effort and maybe sth. for the future.

EDIT: we found another way to tweak, see below

@r10s
Copy link
Contributor Author

r10s commented Jul 18, 2025

talked with @hpk42 , a simple fix covering all interesting paths might be to check for can_send() before adding e2ee-info-message

@r10s
Copy link
Contributor Author

r10s commented Jul 18, 2025

talked with @hpk42 , a simple fix covering all interesting paths might be to check for can_send() before adding e2ee-info-message

this is fine for Bob (the scanner), but Alice (the inviter showing the qr code) still gets two e2ee-info-messages as at the time the chat is created it is probably sendable. as all other cases seem to be fine, i will have a closer look at that case ...

@r10s
Copy link
Contributor Author

r10s commented Jul 18, 2025

@Hocuri thanks a lot for the review, i applied most suggestions - and added an can_send / blocked condition before adding the e2ee-info-message

for the python-tests, would be great if you can have a look there

btw, the PR is running nicely on my iOS phones already

@r10s r10s requested a review from Hocuri July 18, 2025 14:47
@Hocuri Hocuri changed the title add "e2ee encrypted" info message to all e2ee chats feat: add "e2ee encrypted" info message to all e2ee chats Jul 18, 2025
Copy link
Collaborator

@Hocuri Hocuri left a comment

Choose a reason for hiding this comment

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

🎉

Comment on lines -98 to +101
expect(messageList).have.length(1);
const message = await dc.rpc.getMessage(accountId2, messageList[0]);
// There are 2 messages in the chat:
// 'Messages are end-to-end encrypted' (info message) and 'Hello'
expect(messageList).have.length(2);
const message = await dc.rpc.getMessage(accountId2, messageList[1]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know nothing about Typescript, so, I fixed this one by just replacing the number rather than introducing a constant.

@Hocuri
Copy link
Collaborator

Hocuri commented Jul 18, 2025

Macos tests are super flaky :/ now they failed with:

2025-07-18T18:49:42.8473920Z >       log.section("ac1 clone detects that message is marked as seen")
2025-07-18T18:49:42.8474140Z 
2025-07-18T18:49:42.8474200Z tests/test_multidevice.py:88: 
2025-07-18T18:49:42.8474430Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2025-07-18T18:49:42.8474580Z 
2025-07-18T18:49:42.8475050Z self = <deltachat_rpc_client.pytestplugin.log.<locals>.Printer object at 0x000000011091a0c8>
2025-07-18T18:49:42.8475380Z msg = 'ac1 clone detects that message is marked as seen'
2025-07-18T18:49:42.8475530Z 
2025-07-18T18:49:42.8475920Z     def section(self, msg: str) -> None:
2025-07-18T18:49:42.8476120Z         print()
2025-07-18T18:49:42.8476250Z >       print("=" * 10, msg, "=" * 10)
2025-07-18T18:49:42.8476440Z E       OSError: [Errno 9] Bad file descriptor

Will rerun them, but I have no idea what to systematically do about this.

Btw, I just tried to ask Copilot about this error, just for the fun of it, and thinking maybe it has some helpful suggestion. Well, it did not, but wrote a long text about why this problem was caused by a DNS resolution problem. I doubt it 😂

Co-authored-by: Hocuri <hocuri@gmx.de>
@r10s
Copy link
Contributor Author

r10s commented Jul 18, 2025

thanks a lot ❤️

@r10s r10s merged commit 2c7d51f into main Jul 18, 2025
29 checks passed
@r10s r10s deleted the r10s/e2ee-info-message branch July 18, 2025 20:08
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.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载