Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes Riot will say a backup was created by an unknown device when it looks like the device should be known. #8213

Closed
lampholder opened this issue Jan 22, 2019 · 9 comments
Assignees
Labels
A-E2EE P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@lampholder
Copy link
Member

https://github.com/matrix-org/riot-web-rageshakes/issues/1174

image

@lampholder lampholder added T-Defect S-Major Severely degrades major functionality or product features, with no satisfactory workaround A-E2EE mvp P1 labels Jan 22, 2019
@lampholder
Copy link
Member Author

I'll try and get some solid repro steps for this, if I can't we can still look at the code/add some logging to see what's going on.

@lampholder
Copy link
Member Author

Well, I'm seeing it again. And the (extra) problem with it is that when key backup is in this state, you also get the wrong SMR warning when you go to an encrypted room, which invites you to click 'set up' and create a totally new backup

@lampholder
Copy link
Member Author

Right, this time I:

  • set up backup on device with ID UNMBGNLXWU
  • looked at key backup settings on a different device
  • the settings told me 'Backup has a signature from unknown device with ID UNWBGNLXWU'
  • console logs told me 'Ignoring signature from unknown key ed25519:UNWBGNLXWU'

@lampholder
Copy link
Member Author

@ara4n has offered to take a look at this.

@lampholder
Copy link
Member Author

Thoughts from @dbkr:

so I would stick a breakpoint in KeyBackupPanel https://github.com/matrix-org/matrix-react-sdk/blob/master/src/components/views/settings/KeyBackupPanel.js#L64
the first theory I'd test is whether the devices in your device list have got our of sync with your list of keys
because, as I have just been reminded of, they are two different things
that list of devices above is the result of a /devices API call
but all the key backup stuff is based off the keys for devices which is a) from a different API endpoint entirely: /keys/query and b) stored in the client and hopefully updated when it changes
so what I suspect you'll see is that /devices think that device exists but it's not in our local 'cache' in the DeviceList class Encrypted by an unverified device

@lampholder
Copy link
Member Author

console logs told me 'Ignoring signature from unknown key ed25519:UNWBGNLXWU'

This is a red herring - you get this whenever your backup has been signed by a device you haven't verified.

@lampholder
Copy link
Member Author

Okay, I now know some things. The appearance of this issue is dependent upon the information stored in your indexeddb device_data table.

When you log in from a fresh client, this table contains a json object with a reference to just your new device. Certain things will trigger its being poplated with a full list of your devices:

  • look at the memberinfo for your own account
  • try and send a message in an encrypted room (you'll get the 'unknown devices present' notif, it doesn't matter how you respond to this)

Empirically, just logging in on a new device does not prompt your other devices to refresh their list of your devices stored in device_data.

The problem is, the key backup UX appears to be assuming that device_data has fresh device information, but it doesn't.

@lampholder
Copy link
Member Author

Dave is 95% confident that adding a new device is supposed to trigger a poke to your existing devices prompting them to update their local device_data with your new device information.

As I said above, this isn't happening. If it were happening in the past, it could have been broken for ages without our noticing - prior to key backup, you only needed a fresh list of your devices before sending an encrypted message, and however it's happening device_data is being refreshed before that.

The upshot of this is if you create two devices, set up key backup on one and then try to use that backup on the second, your second device will say the backup is signed by an 'unknown' device.

You can force device_data to be refreshed by:

  • trying to send a message in an encrypted room, or
  • looking at your own memberinfo

The table of devices is populated by a call to /devices, so it contains fresh information.

dbkr added a commit to matrix-org/matrix-js-sdk that referenced this issue Feb 1, 2019
This was causing all the cross-signing stuff to fail and was almost
certainly the cause of element-hq/element-web#8213
@dbkr
Copy link
Member

dbkr commented Feb 1, 2019

This ^ was almost certainly the cause of this bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-E2EE P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect
Projects
None yet
Development

No branches or pull requests

3 participants