element-web icon indicating copy to clipboard operation
element-web copied to clipboard

ElementR | Element R doesn't warn the user when the key backup has been deleted or reset from another session

Open BillCarsonFr opened this issue 2 years ago • 3 comments

The code is on MatrixChat.tsx in react sdk

 cli.on(CryptoEvent.KeyBackupFailed, async (errcode): Promise<void> => {
            let haveNewVersion: boolean | undefined;
            let newVersionInfo: IKeyBackupInfo | null = null;
            // if key backup is still enabled, there must be a new backup in place
            if (cli.getKeyBackupEnabled()) {
                haveNewVersion = true;

stack trace:

client.ts:3423 Uncaught (in promise) Error: End-to-end encryption disabled
    at MatrixClient.getKeyBackupEnabled (client.ts:3423:19)
    at MatrixClient.<anonymous> (MatrixChat.tsx:1677:21)
    at MatrixClient.emit (events.js:153:1)
    at MatrixClient.emit (typed-event-emitter.ts:89:22)
    at RustCrypto.forSource (ReEmitter.ts:55:29)
    at RustCrypto.emit (events.js:153:1)

Step to reproduce

  • Register on web and setup recovery
  • Send a few message from that session
  • Login on another session
  • From the other session, reset the backup
  • From the first session, type /discardsession then type a new message to trigger a key upload

Expected

Should show this popup image

Actual

Nothing happens

BillCarsonFr avatar Dec 20 '23 11:12 BillCarsonFr

@BillCarsonFr when is this codepath reached?

richvdh avatar Jan 15 '24 14:01 richvdh

@BillCarsonFr when is this codepath reached?

It's emitted in the key backup upload loop, in case of M_WRONG_ROOM_KEYS_VERSION errors for example.

https://github.com/matrix-org/matrix-js-sdk/blob/2ef3ebb466ece630eba88ef29565d71a88efca08/src/rust-crypto/backup.ts#L371

BillCarsonFr avatar Jan 15 '24 16:01 BillCarsonFr

Should make it consistent with element-x behavior (Please Confirm your recovery Key) when your local secrets are out of date. https://github.com/element-hq/element-meta/blob/develop/docs/crypto/backup.md#recovery-settings

BillCarsonFr avatar Mar 01 '24 12:03 BillCarsonFr

Seems to have been duplicated by #29170. This one existed first, but the other has been linked in more places, so closing this one.

richvdh avatar Aug 21 '25 14:08 richvdh