matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.83k stars 2.13k forks source link

Synapse doesn't send out device list updates to previously unseen homeservers when joining a room #11374

Open anoadragon453 opened 2 years ago

anoadragon453 commented 2 years ago

The spec says that:

Servers must send m.device_list_update EDUs to all the servers who share a room with a given local user, and must be sent whenever that user’s device list changes (i.e. for new or deleted devices, when that user joins a room which contains servers which are not already receiving updates for that user’s device list, or changes in device information such as the device’s human-readable name).

Which to be clear, means that upon a local user joining a room, we should:

  1. Check if any of the other homeservers in the room are new to us (their users don't share any other rooms with us)
  2. Send device list updates of the joining user to those homeservers.

It doesn't appear that Synapse actually does this anywhere, currently.

We also need to do this for presence (https://github.com/matrix-org/synapse/issues/8956), but the current presence-related TODO in the code may be a good inspiration for what a device list related implementation would look like:

https://github.com/matrix-org/synapse/blob/75ca0a6168f92dab3255839cf85fb0df3a0076c3/synapse/handlers/presence.py#L1368-L1379

uhoreg commented 2 years ago

Probably makes sense to make sure that m.signing_key_update is sent in that case too.

anoadragon453 commented 2 years ago

Note that when a user joins a room, that user's /sync stream is populated with all other user IDs from the room: https://github.com/matrix-org/synapse/blob/a19d01c3d95f5dbd3a4bb181cb70dacd44135a8b/synapse/handlers/sync.py#L1277-L1280

But that still doesn't help remote users when we join a room.