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

Incoming verification request is ignored if it arrives before the device list is updated

Open
#5,007 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-Encryption
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

STR are something like:

* Background the EX app
* Log in a new session elsewhere
* From that new session, send a verification request
* Open EX
* Nothing

The problem, as observed from a rageshake, is that the incoming verification request arrives before the device list is updated, meaning it is ignored:

```
2025-05-06T13:06:21.461830Z WARN matrix_sdk_crypto::verification::machine: Could not retrieve the device data for the incoming verification request, ignoring it | crates/matrix-sdk-crypto/src/verification/machine.rs:375 | spans: root > next_sync_with_lock{store_generation=1969} > sync_once{conn_id="encryption" pos="0/m5872750001~1.5872750003~2.5872750005~36.5872750004~3.5872750008_757284974_6725431_m3612552074~72.3612552076_4041061653_265563348_1484733902_11123463783_0_472626"} > handle_response > receive_sync_changes > receive_to_device_event{sender="@dave:matrix.org" event_type="m.key.verification.request" } > receive_any_event{flow_id="891f6afab75d4363b16285a69ddcbe92"}
```

It feels like we should (a) make sure we flag the device list as outdated before processing the to-device messages (i.e., process the device lists part of the sync response before the to-device messages); (b) if the device list is outdated, wait a while to see if it gets updated before discarding the request.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in crates/matrix-sdk-crypto/src/verification/machine.rs around line 375 and reproduce the listed sync-order scenario. Trace how device-list updates and to-device verification requests are processed, then determine how an outdated device list should be handled before the request is discarded. Done means an incoming verification request is not ignored when it arrives before the device list update.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.