matrix-org / synapse

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

Federation: /rooms/.../members fails for the invites received from a federated server #4985

Open giomfo opened 5 years ago

giomfo commented 5 years ago

Description get /_matrix/client/r0/rooms/{roomId}/members on an invite received from another federated server fails with the following error:

errcode = "M_NOT_FOUND";
error = "Can't find event for token Token(room_key=u'xxx', presence_key=u'xxx', typing_key=u'x', receipt_key=u'xxx', account_data_key=u'xxx', push_rules_key=u'xx', to_device_key=u'xxx', device_list_key=u'xxx', groups_key=u'xx')";

Steps to reproduce Consider 2 users userA and userB, created on 2 different Homeservers. userA creates a room and invites userB When userB requests for the members of this room, he gets an error

DMRobertson commented 1 year ago

Given that we're not yet joined to the room, we don't have any sense of its current state and hence have no idea who's in the room.

The invite event may include stripped state events in its unsigned.invite_room_state, but this doesn't include membership events.

DMRobertson commented 1 year ago

The spec is not explicit but my reading of https://spec.matrix.org/v1.5/client-server-api/#get_matrixclientv3roomsroomidmembers is that we should return HTTP 403 in this situation.

The error comes from https://github.com/matrix-org/synapse/blob/86c5a710d8b4212f8a8a668d7d4a79c0bb371508/synapse/handlers/message.py#L205-L206 which is called https://github.com/matrix-org/synapse/blob/86c5a710d8b4212f8a8a668d7d4a79c0bb371508/synapse/rest/client/room.py#L590-L595

So this is another example of NotFoundError bubbling up to the rest layer and deciding what the status code is.

DMRobertson commented 1 year ago

If anyone wants to take this on, I suggest:

vemmos commented 1 year ago

Hello there! Is this still up?I would like to contribute :)

squahtx commented 1 year ago

Hello there! Is this still up?I would like to contribute :)

The issue has not been fixed yet. Feel free to PR a fix.