matrix-rust-sdk icon indicating copy to clipboard operation
matrix-rust-sdk copied to clipboard

Update message sender trust status when user's verification state improves

Open andybalaam opened this issue 6 months ago • 1 comments

Follow up to https://github.com/matrix-org/matrix-rust-sdk/issues/3544

If a user is in verification violation and then they become verified OR we withdraw verification (making them unverified), update their sessions so messages from them have the updated status.

Current situation

  • On Web, if you verify after being in verification violation, your new messages have no shield. (Also old messages, at least some of them.)

image

  • On Element X, if you verify after being in verification violation, your new messages have no shield. (Your old ones keep the shield that they gained when you were in verification violation.)

image

So in both cases, new messages are displayed correctly. This story is to fix old messages.

This may already be fine on Web, in which case this story is just to fix Element X.

Implementation

  • Allow querying inbound group sessions by master key (remember to populate even for Unverified sessions)

    • Add an indexed column on master key
    • Populate it
    • Allow querying based on it
  • Update SenderData when an identity becomes verified or verification is withdrawn.

    • When /keys/query shows someone became verified recalculate all sessions for that master key with Unverified or PreviouslyVerified state
    • When we withdraw verification recalculate all sessions for that master key with PreviouslyVerified state
  • Notify the UI code that the message needs updating (maybe by re-running decryption, or just by updating the shields)

andybalaam avatar Aug 23 '24 14:08 andybalaam