-
Notifications
You must be signed in to change notification settings - Fork 336
Description
Part of Invisible Crypto.
Currently when we store an Inbound group session, we associate some SessionCreatorInfo to it. Currently this info mainly contains the curve25519
identity key of the session creator.
We need now to add more info:
user_id
- the associated mxid of the session creator (rooted in Master Signing Key authenticity).master_key
- the Master Signing Key signing (via the SSK) this device at time of reception.master_key_verified
- true if at time of reception the user was verified (see here)
We are currently computing the "authenticity" of a megolm session but we are doing it at decryption time.
The info we get at decryption time are sender: OwnedUserId
and sender_device: OwnedDeviceId
.
Both related to a VerificationState
. This owner info is untrusted (claimed), unless the VerificationState is Trusted.
The VerificationState variants are:
- Verified
- Unverified::UnverifiedIdentity
- Unverified::UnsignedDevice
- Unverified::MissingDevice
- Unverified::InsecureSource
We are basically trying to get this same info but at reception time.
Three places we populate SenderData in an InboundGroupSession
-
When we receive the room keys via a to-device message. (This is already done via SenderDataFinder.)
-
When we get new or updated device info from /keys/query. To do this we need to be able to look up InboundGroupSessions that don't have SenderData by device curve key. This will require a new index on the inboundgroupsessions table. Question: if there are lots of sessions for a particular device, will we break everything by working through batches of them to update them?
-
When we decrypt a message for a session. In this case we have the session and device already, so it's just a case of persisting (into inboundgroupsessions) the VerificationState that we already look up at this moment.
The plan
In order to complete this we need to do these tasks:
- Sender Data: Support sender data in InboundGroupSession and InboundGroupSessionPickle #3542
- Sender Data: Fetch and store sender data when we receive a new megolm session #3543
- Sender Data: When we decrypt a message in an InboundGroupSession that is missing SenderData, populate it with what we know #3751
- Populate missing SenderData when we receive device info:
- Sender Data: Validate SenderData using
Device::is_owner_of_session
#3754 - Sender Data: Remove retry data from SenderData enum #3755
- crypto: Mark all new SenderData info as non-legacy #3785
Old tasks that are no longer relevant (see old plan in a comment below):
Sender Data: Change DB schemata to add next_retry_time_ms property/column #3545Sender Data: Background task to retry fetching sender data for megolm sessions #3546Sender Data: Async migration task to prepare old sessions for fetching sender data #3547 (essentially just adds anext_retry_time
so they get retried)
Out of scope
- finish MSC4147
- Store and retrieve sender data to/from backed up (and exported) sessions #3548 . Requires an MSC.
- Update message sender trust status when user's verification state improves #3890
[Moved from https://github.com/element-hq/crypto-internal/issues/310]