Description
Using the Rust crypto SDK from two tabs at once will cause data corruption, due to the fact that the rust-sdk caches information in memory.
Examples of the sorts of problems that could arise:
-
If you send messages from both tabs to the same room, we could use the same megolm ratchet index (this is exactly the problem in Wrong message index when sending an image via Share Extension, message not decryptable in Element-Web, can break rooms when session-ID is affected! element-ios#7499)
-
We might create two Olm one-time-keys with the same ID, causing problems like Lost OTK, leading to "OneTime key already exists" error and later UTDs matrix-org/matrix-rust-sdk#1415.
-
Most disasterously of all, suppose:
- You share two encrypted rooms with your colleague Bob
- In one tab, you send a message in one room; in the other tab, you send a message in the other room.
In this case, each message will necessitate a megolm keyshare, which will cause the ratchet for the Olm session shared between you and Bob to be advanced. However, this will cause unrecoverable corruption to the Olm session.
In other words, you and Bob will never be able to communicate again.