synapse icon indicating copy to clipboard operation
synapse copied to clipboard

When knocking, Synapse returns and accepts a list of stripped state events in an incorrectly named field

Open anoadragon453 opened this issue 1 year ago • 0 comments

When a homeserver knocks on a room over federation, it calls the PUT /_matrix/federation/v1/send_knock/{roomId}/{eventId} endpoint on the remote homeserver. The remote homeserver can then return a set of stripped state events that describe the room, which are passed subsequently to the client.

The response field for a knock's stripped state events is defined in the spec as knock_room_state. It looks like it was implemented as knock_state_events in https://github.com/matrix-org/synapse/pull/6739/files#diff-996dafa2cabdf043e51a444e5d3c5ba8389d48e6cdab0d469677974bd470d58fR686. A subtle but important difference.

As far as I can tell, this is a problem that's exclusive to Synapse. Conduit does not implement knocking, Dendrite supports knock membership but not initiating a knock.

Assuming we want to support older Synapse's knocking through a newer Synapse and vice versa, a backwards-compatible fix would involve:

If we didn't implement backwards-compatibility, a user on an old Synapse (or knocking on a new Synapse through an old Synapse) would (assuming knocking was implemented in any clients) see only a room ID in their "pending knocks" list, instead of a room name/avatar/any other metadata.

Alternatively we could opt for changing the field name in the spec and leave Synapse as is, but I'd be adverse as knock_room_state currently lines up nicely with invite_room_state for PUT /_matrix/federation/v2/invite/{roomId}/{eventId} . It'd also require an MSC.

anoadragon453 avatar Oct 06 '22 16:10 anoadragon453