matrix-org / matrix-org/matrix-rust-sdk

User verification via room might fail depending on the encryption settings

Open
#4,768 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

Step to reproduce:

- Alice logs in on Element X
- Alice creates a DM with Bob
- Alice logs in on web but does not verify this new session.
- (Notice that at this point, Alice sending a message from Element X will fail because Alice has an insecure device.)
- On Element X, Alice goes to Bob's profile and tries to verify him

Actual:
Nothing happens

Expected:
Verification should start

The error is:
```
2025-03-06T18:45:00.024483Z ERROR elementx: Failed requesting verification for user @xxxx:matrix.org with error: Generic(msg: "encryption failed due to an error collecting the recipient devices: one or more verified users have unsigned devices") | SessionVerificationControllerProxy.swift:113 | spans: root

2025-03-06T18:45:00.024632Z INFO elementx: Transitioning from `requestingVerification` to `initial` with event `didFail` | SessionVerificationScreenStateMachine.swift:128 | spans: root
```

As per spec:

> When using in-room messages and the room has encryption enabled, clients should ensure that encryption does not hinder the verification. For example, if the verification messages are encrypted, clients must ensure that all the recipient’s unverified devices receive the keys necessary to decrypt the messages, even if they would normally not be given the keys to decrypt messages in the room. Alternatively, verification messages may be sent unencrypted, though this is not encouraged.

A similar "fix" was done on [legacy sdks](https://github.com/element-hq/element-android/pull/7290), to "allow" sending verification messages even to insecure devices

Contributor guide

Open the contributing guide

Research direction

Start by tracing the verification request path associated with SessionVerificationControllerProxy.swift and SessionVerificationScreenStateMachine.swift. Inspect how encrypted in-room verification collects recipient devices when an unverified device is present, then compare the behavior with the Matrix specification and the linked legacy SDK change. Done means verification starts successfully in the reproduced setup, with coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.