WebR: Sometimes after migrating to rust crypto the existing session reverts back to untrusted #27079
Labels
A-Element-R
Issues affecting the port of Element's crypto layer to Rust
O-Occasional
Affects or can be seen by some users regularly or most users rarely
S-Minor
Impairs non-critical functionality or suitable workarounds exist
T-Defect
Z-Element-R-Blocker
A blocker for enabling Element R by default
Z-Labs
A session which was previously using legacy crypto (and was verified), is now showing previously trusted users with red shields after migration to rust-crypto.
The current session is not trusted anymore, as shown in the settings:

What's happening
It's a case of partially known secrets. The legacy session is missing the MSK private key (not in cache).
In legacy, after verification when the cross-signing keys are trusted the public part of the keys are persisted locally, thus making them locally trusted.
Later in the process, the private keys would be requested to other sessions.
In some cases the
m.request.secret
can fail (network issue, the original session was missing them), so you could end up with a trusted session that only has some of the private cross-signing keys.It is also possible that you have a quite old session, and at some point on web the MSK was not cached locally. Notice that any session verified from a session with partial secrets, will also have partial secrets (verification will be succesfull marking the cross signing keys as trusted, but secret gossiping will only get you what the original session has)
When we migrate the account over to rust crypto, the local trust flag of cross-signing keys is lost. Rust crypto will only consider the current session as trusted if we import the private cross-signing keys correctly.
Solution
WebR should prompt users when the current device is not trusted, and ask them to verify.
It appears that this is done only after login? Currently if the cross signing keys are reset from another session web (including legacy) is not prompting the user to verify again?
This flow should be customised after migration, to display a specific copy:
Title: "Security upgraded"
Message: "Secure messaging has been improved with the latest update. Please re-verify your device."
Similar issues on EAR and EIR
https://github.com/element-hq/crypto-internal/issues/58
Alternative
We could also migrate local trust?.
Given that anyhow if we had performed a verification with the "legacy account" for a new rust session, at the end the new rust session would trust the identity
The text was updated successfully, but these errors were encountered: