Skip to content

feat!: Remove ability to send&receive unencrypted, migrate address-contacts - #8808

Open
Hocuri wants to merge 10 commits into
hoc/remove-unencrypted-tests-2from
hoc/remove-unencrypted
Open

Hocuri wants to merge 10 commits into
hoc/remove-unencrypted-tests-2from
hoc/remove-unencrypted

Conversation

@Hocuri

@Hocuri Hocuri commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #8775

Warning: Do NOT test this PR with a life account of yours! It might remove existing unencrypted messages. Instead, test #8930, which is based on this PR here.

TODO:

Follow-up PRs that need to be stack-merged together with this one:

Things I considered but didn't implement:

  • Rather than removing all members from ad-hoc groups, we could remove only ContactID::SELF. This would be enough for making them read-only, but it doesn't really matter. The sender of a message can be seen by tapping on the sender avatar of a message.
  • Inline create_and_deduplicate_from_bytes() so that the migration doesn't depend on external code. Seems fine as-is; if we ever remove create_and_deduplicate_from_bytes(), we can just remove the respective code from the migration.

What I will do in future PRs (not in the current PR stack):

  • Another migration to give all of the ad-hoc groups a fake group ID. The reasoning is: While today's code handles empty group-ids just fine, we don't want to keep this special-case in mind forever.
    • Need to test what happens when the group ID is not the same on different devices, and then the user pins the chat on one of the devices. Syncing doesn't have to work, but also, it shouldn't fail terribly, e.g. by creating an empty chat on the second device.
  • Similarly, give all of the address-contacts a fake fingerprint
  • Remove all the APIs
  • Refactorings to remove code that is not needed anymore, like Contact::create()

BREAKING CHANGE: Removed force_encryption config; encryption is always forced now
BREAKING CHANGE: Removed stock string InvalidUnencryptedMail = 174 (translated as invalid_unencrypted_tap_to_learn_more)
BREAKING CHANGE: Added stock string NoMoreUnencrypted = 250 (translated as devicemsg_no_more_unencrypted)
BREAKING CHANGE: Remove DC_INFO_INVALID_UNENCRYPTED_MAIL / SystemMessageType::InvalidUnencryptedMail

@Hocuri
Hocuri marked this pull request as draft October 7, 2026 08:55
@Hocuri Hocuri changed the title Migrate unencrypted contacts to be read-only feat: Migrate unencrypted contacts to be read-only Oct 7, 2026
@Hocuri
Hocuri force-pushed the hoc/remove-unencrypted branch 7 times, most recently from b5acd08 to 71d920b Compare October 13, 2026 11:53
@Hocuri
Hocuri force-pushed the hoc/remove-unencrypted branch 2 times, most recently from 1cf1b3c to 25671dc Compare November 18, 2026 13:49
@Hocuri Hocuri changed the title feat: Migrate unencrypted contacts to be read-only feat: Remove ability to send&receive unencrypted, migrate address-contacts Nov 18, 2026
@Hocuri
Hocuri force-pushed the hoc/remove-unencrypted branch from 25671dc to 720e0d4 Compare November 18, 2026 15:55
@Hocuri
Hocuri changed the base branch from main to hoc/remove-unencrypted-tests-2 November 18, 2026 15:55
@Hocuri
Hocuri added this pull request to stack #8925 November 18, 2026 15:55
@Hocuri
Hocuri force-pushed the hoc/remove-unencrypted branch from 720e0d4 to 8d7bda1 Compare November 18, 2026 16:10
@Hocuri Hocuri changed the title feat: Remove ability to send&receive unencrypted, migrate address-contacts feat!: Remove ability to send&receive unencrypted, migrate address-contacts Nov 19, 2026
@Hocuri
Hocuri force-pushed the hoc/remove-unencrypted branch 4 times, most recently from 5fbb29a to 3bc3619 Compare November 23, 2026 12:11
Comment thread src/chat.rs Resolved
Comment thread deltachat-ffi/deltachat.h Resolved
Comment thread src/receive_imf.rs
) -> Result<Option<ContactId>> {
logged_debug_assert!(
context,
ensure!(

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.

does that change end up in a device message as "❌ Failed to receive a message … Please report this bug to [email protected] ..."

this is not really smth the user should report to us or where the user is actionable - also that can easily ends up in spammed device chat.

it seems better to ignore that as before and log an error.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Seems nice to know if we forgot some code that is still calling lookup_key_contact_by_fingerprint() with an empty fingerprint since that should never happen, but it's not that important, we can also just ignore and log it.

Comment thread src/stock_str.rs

To keep chatting with someone, send them an invite link."
))]
NoMoreUnencrypted = 250,

@r10s r10s Nov 25, 2026 •

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.

this value is missing in deltachat.h - and maybe also in jsonroc

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We don't have jsonrpc documentation for the strings, unless I missed something. Added it to deltachat.h

@Hocuri
Hocuri force-pushed the hoc/remove-unencrypted branch 4 times, most recently from f95b027 to 02a615b Compare November 25, 2026 16:54
Comment thread src/securejoin.rs
Comment on lines +95 to +99
if !chat.is_self_in_chat(context).await? {
let err = format!("Can't generate QR code, self is not a member of chat {id}");
error!(context, "get_securejoin_qr: {err}.");
bail!(err);
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This change is necessary to make ensure that no QR codes can be generated for the migrated groups and mailinglists. The error!() here is a bit weird, but I included it because the other error paths in this function also have it; might as well remove it completely from this function.

In its stead, remove `recode_avatar` high-level migration. It was added
5 years ago, and even if someone updates Delta Chat after such a long
time, large avatars are not a problem anymore since we don't send them
in unencrypted messages.
The change to can_send() is most important, because it makes
`can_send()` return false for legacy unencrypted 1:1 chats
@Hocuri
Hocuri force-pushed the hoc/remove-unencrypted branch from 571af34 to 52b643b Compare November 26, 2026 16:07
@Hocuri
Hocuri marked this pull request as ready for review November 26, 2026 16:08
@Hocuri
Hocuri requested review from hpk42 and link2xt November 26, 2026 16:08

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove the capability to send and receive unencrypted

2 participants