matrix-org / matrix-org/matrix-rust-sdk
Olm sessions are vulnerable to wedging on OS crash or power failure, leading to UTDs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
Consider:
- Alice and Bob have an active Olm session.
- Alice is using a client which uses the indexeddb backend of matrix-crypto-sdk. She wants to send a new Olm message, so she generates a new Olm ratchet key and updates the session. She can then encrypt the new message, and stores the updated session in the database
- Alice sends the message.
- Alice's computer crashes.
- Alice reboots
- If the updated session was not correctly persisted before the crash, this Olm session is now wedged: Alice cannot decrypt any replies from Bob, and, because Alice will use the wrong ratchet key in the next sender chain, Bob will be unable to decrypt any further messages from Alice.
Currently, we use the "default" durability mode of IndexedDB, which [can lead to data loss](https://developer.chrome.com/blog/indexeddb-durability-mode-now-defaults-to-relaxed). We should instead use "strict", at least for transactions which update Olm sessions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the IndexedDB backend in matrix-crypto-sdk and the transactions that update Olm sessions. Trace how durability is configured, then verify that the relevant session-update transactions use strict durability and test the persistence behavior across an interrupted write.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cryptography, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100