matrix-org / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://matrix-org.github.io/dendrite/
Apache License 2.0
5.67k stars 664 forks source link

Unable to remove old sessions #1984

Closed alistair23 closed 2 years ago

alistair23 commented 3 years ago

Background information

Description

When using Element I see a list of devices in my profile.

Some of the devices match what I see under Where you’re logged in in the Security and Privacy section. I can change the name, verify them and they work correctly.

There are also some devices that aren't listed under Where you’re logged in. These are old devices that are no longer used. They are unverified (as I can't verify them) and there is no way to remove them or change the names.

Steps to reproduce

neilalexander commented 3 years ago

This happened I suppose because the user API's device list and the key server's device list got out of sync. The Where you're logged in section will be reporting keys from the user API, but the device list in the user profile will be reporting keys from the key server.

I think this bug is actually already fixed by the introduction of the PerformDeleteKeys API on the key server in #1979, as the user API will now tell the key server to delete keys when deleting a device.

We will need to think about how to clean up stale entries from before the fix.

alistair23 commented 3 years ago

Any update on this? Even being able to manually fix it would work

alistair23 commented 2 years ago

Any ideas?

kegsay commented 2 years ago

@alistair23 can you try this on latest master please - https://github.com/matrix-org/dendrite/commit/2c581377a5f6b243300445947fd0fd38a919873d

I cannot reproduce this issue by doing the following:

Versions:

Element version: 869b271f72f9-react-869b271f72f9-js-869b271f72f9
Olm version: 3.2.8
alistair23 commented 2 years ago

So I don't think you can get into this state anymore as @neilalexander pointed out, it has been fixed. The problem is that for people who had sessions before the fix, there is no way to cleanup the old sessions.

I'm guessing that some SQL commands would work or resetting all sessions, but I have no idea how to do either.

alistair23 commented 2 years ago

This seems to be fixed with https://github.com/matrix-org/dendrite/pull/2186

kegsay commented 2 years ago

That is probably because that PR logged out all active sessions.