element-hq / element-hq/element-meta

Element X can't start a DM when the server refuses encrypted rooms

Open
#3,280 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
112
Forks
25
Avg merge
6h 6m
Merged PRs (30d)
4

Description

Element X always requests an encrypted room when you start a DM. If the homeserver refuses encrypted rooms, room creation fails and all the user sees is "An error occurred when trying to start a chat". From the phone there is then no way to start a conversation at all.

We run Synapse with encryption off. That is deliberate: our rooms carry bots and widgets that would go silent, and we would lose server side search on a server we host ourselves. Synapse enforces it through `default_power_level_content_override`, putting `m.room.encryption` above the level anyone reaches, and it rejects the create call before the room exists:

```
SynapseError: 403 - You cannot create an encrypted room. user_level (100) < send_level (999)
POST /_matrix/client/v3/createRoom 403 "Element X/26.07.4 (Mac; ...)"
```

Element Web and Element Desktop hit the same endpoint a minute earlier and got a 200, because they read `io.element.e2ee.force_disable` from the client well-known, which we publish:

```json
"io.element.e2ee": { "default": false, "force_disable": true }
```

### Reproducing it

1. Configure Synapse to refuse encrypted rooms (`encryption_enabled_by_default_for_room_type: off`, plus an `m.room.encryption` power level nobody has).
2. Serve `io.element.e2ee.force_disable: true` in `/.well-known/matrix/client`.
3. Search for a user in Element X and start a chat.

You expect an unencrypted DM, the same one Element Web creates. You get an error dialog.

### Half of this already exists on iOS

https://github.com/element-hq/element-x-ios/pull/5866 replaced the hardcoded `isEncrypted: true` in `ClientProxy` with `!appSettings.forceDisableE2EE.publisher.value`, and that shipped in 26.07.4. But nothing in the open source tree ever sets the flag. `forceDisableE2EE` is a `RemotePreference` defaulting to `false` and no code calls `applyRemoteValue` on it. The PR says it is controlled by Element Pro, which leaves self hosted servers where they started.

Android does not have the flag at all. `RustMatrixClient.createDM` still passes `isEncrypted = true` with nothing to override it.

### What we are asking for

Let the homeserver set that flag, not just Element Pro. `io.element.e2ee.force_disable` already means exactly this and Element Web honours it, so the value is sitting there unread. `RemoteSettingsHook` fetches `.well-known/element/element.json` already and decodes `enforce_element_pro`, and the MapTiler setting shows the pattern of pushing a well-known value into a `RemotePreference`. And the same flag on Android.

As it stands, Element X is unusable as a mobile client on any server that turns encryption off, other than for reading along. Which is a pity, because it is otherwise the nicer of the two mobile apps.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with iOS ClientProxy and the RemotePreference forceDisableE2EE flow, including RemoteSettingsHook and applyRemoteValue; compare that with Android's RustMatrixClient.createDM. Verify how the client well-known value is decoded, then confirm that force_disable reaches both clients and allows an unencrypted DM when the homeserver rejects encrypted rooms.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, ios, rust
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.