Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Database stores multiple cross-signing keys of the same type for a given user #16398

Open
richvdh opened this issue Sep 28, 2023 · 2 comments
Open
Labels
A-E2EE End-to-end encryption for Matrix clients O-Occasional Affects or can be seen by some users regularly or most users rarely S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@richvdh
Copy link
Member

richvdh commented Sep 28, 2023

The Matrix protocol assumes that each user will have at most one cross-signing key of a given type (master, self_signing, user_signing) at a time.

However, it is possible for clients to replace the existing keys with further calls to POST /_matrix/client/v3/keys/device_signing/upload. When that happens, Synapse appears to just add the new key to e2e_cross_signing_keys without deleting the old one. Some matrix.org users have accumulated over 2000 keys of each type.

This is redundant data which we have no business keeping (and it sucks up disk space).

There also seems to be a codepath somewhere where we end up with multiple copies of a key for a remote user get stored in the database.

Ideally the e2e_cross_signing_keys table should be UNIQUE in (user_id, keytype).

@erikjohnston erikjohnston added S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. O-Occasional Affects or can be seen by some users regularly or most users rarely A-E2EE End-to-end encryption for Matrix clients labels Oct 2, 2023
@erikjohnston
Copy link
Member

Is this causing any user visible problems? Though I agree we should fix it.

@richvdh
Copy link
Member Author

richvdh commented Oct 2, 2023

No, it's just a case of filling up a database with stuff a user would reasonably expect us to have deleted.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-E2EE End-to-end encryption for Matrix clients O-Occasional Affects or can be seen by some users regularly or most users rarely S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

2 participants