element-hq / element-x-ios

Next generation Matrix client for iOS built with SwiftUI on top of matrix-rust-sdk.
https://element.io/labs/element-x
GNU Affero General Public License v3.0
426 stars 105 forks source link

E2EE Keys shared on being invited to a room are ignored. #1842

Open ara4n opened 1 year ago

ara4n commented 1 year ago

Steps to reproduce

  1. Invite a user on EX to a room from EW
  2. EW shares the keys to them they need to decrypt the history
  3. EX promptly ignores those keys with errors like:

2023-10-01T23:58:41.991407Z WARN matrix_sdk_crypto::gossiping::machine: Received a forwarded room key that we didn't request sender_key="curve25519:dDzGIsdDzjt2uWgLDg0U05v2s0NAdjiqYpYjryPa7To" room_id="!kCCQTCfnABLKGGvQjo:matrix.org" session_id="gPbOMSzHA67qrteCF3gi3/6VfWgcqSLgpF+N9aFZKqU" sender_key="curve25519:dDzGIsdDzjt2uWgLDg0U05v2s0NAdjiqYpYjryPa7To" algorithm="m.megolm.v1.aes-sha2" | crates/matrix-sdk-crypto/src/gossiping/machine.rs:978 | spans: root > sync_stream{conn_id="encryption" with_e2ee=true} > sync_once{pos="141"} > handle_response > preprocess_to_device_events > receive_sync_changes > receive_to_device_event{sender="@matthew:matrix.org" event_type="m.room.encrypted" message_id="98b4e05a-9cc4-440e-96d5-5c99a2fe1d67"} > handle_decrypted_to_device_event{sender_key="curve25519:dDzGIsdDzjt2uWgLDg0U05v2s0NAdjiqYpYjryPa7To" event_type="m.forwarded_room_key"}

Outcome

What did you expect?

Users should be able to read history when invited to a room.

What happened instead?

Undecryptable history, UISIs everywhere.

N.B. this is not the same as https://github.com/vector-im/element-x-ios/issues/1496 - where EX fails to send keys; here the problem is EX ignoring keys.

Your phone model

No response

Operating system version

No response

Application version

396

Homeserver

No response

Will you send logs?

Yes

giomfo commented 8 months ago

@manuroe I think you should close this issue. Sharing room history keys is not supported in the new EW-R client. We should wait for the new design of this feature to implement it correctly in EX. This should be handled as a feature request (not an issue anymore)

manuroe commented 8 months ago

I turned it into a feature instead of a T-Defect