Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newly joined users can't decrypt messages from existing users in an e2e room. #2249

Closed
ara4n opened this issue Sep 17, 2016 · 4 comments
Closed
Labels
A-E2EE P1 S-Critical Prevents work, causes data loss and/or has no workaround T-Defect

Comments

@ara4n
Copy link
Member

ara4n commented Sep 17, 2016

Lots of instances this evening in various sets of existing users not being able to see messages from other users, despite everyone being on olm 1.3.0.

My stream of consciousness is something like:

it seems that when a device first speaks in a room, it sends an m.room_key via toDevice
but i don't see it sending m.new_device anywhere
and meanwhile other devices never send it a m.room_key
so it simply isn't aware of the ongoing sessions.
which feels to me like matrix-org/matrix-js-sdk#204 is entirely broken
i just don't see the logic anywhere when a device receives an m.room_key that it says "ooh, new device! i'd better send it my room_key data too!"
unless it actually saw an m.new_device. except we seem quite shy about ever sending m.new_device. especially if we've been lurking in the room pre-e2e? or on an older version of olm?
so it feels to me like we should be much more aggressive about sending new_device announcements, as well as interpreting room_keys from unknown devices as... a new_device.

@ara4n ara4n added T-Defect P1 S-Critical Prevents work, causes data loss and/or has no workaround A-E2EE labels Sep 17, 2016
@ara4n
Copy link
Member Author

ara4n commented Sep 17, 2016

(closely related to #2204, which has the same symptoms)

@ara4n
Copy link
Member Author

ara4n commented Sep 17, 2016

So, I just reproduced one failure mode using basically the same steps as #2204, although presumably the root cause is different.

screen shot 2016-09-17 at 13 19 57

Account on the left is @matthewtest30. Account on the right is @matthewtest31.

  • 30 creates a new room.
  • 30 turns on encryption
  • 30 says something
  • 30 invites 31
  • 31 joins
  • 31 says something; 30 decrypts it ok.
  • 30 says something; 31 can't decrypt it.

Looking at the console logs, it seems 30 sees a room_key when 31 starts speaking, so knows about 31's session.
31 however never sees a room_key, nor a new_device from 30, so doesn't know about 30's session.

Naively, it looks to me like we're forgetting to send room_keys to new devices when they join rooms. And meanwhile the reliability mechanisms for sending new_devices when we see unknown session (matrix-org/matrix-js-sdk#204) are broken too.

Both on latest develop with olm 1.3.0.

@ara4n
Copy link
Member Author

ara4n commented Sep 17, 2016

(the reason I'm testing this flow is that it's the classic and probably most common use case of setting up a 1:1 encrypted chat)

@ara4n ara4n changed the title Existing users often can't decrypt messages for newly participating users in #megolm Newly joined users can't decrypt messages from existing users in an e2e room. Sep 17, 2016
richvdh added a commit to matrix-org/matrix-js-sdk that referenced this issue Sep 17, 2016
When a new user joins a room, make sure we download their device list if we
don't already have it.

This should fix at least one cause of
element-hq/element-web#2249.
@ara4n
Copy link
Member Author

ara4n commented Sep 17, 2016

confirmed fixed

@ara4n ara4n closed this as completed Sep 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-E2EE P1 S-Critical Prevents work, causes data loss and/or has no workaround T-Defect
Projects
None yet
Development

No branches or pull requests

1 participant