synapse-admin icon indicating copy to clipboard operation
synapse-admin copied to clipboard

fix: prevent requests from failing

Open c-cal opened this issue 3 years ago • 2 comments

Encode userId to handle the case of a localpart with a forward slash

Fixes: https://github.com/Awesome-Technologies/synapse-admin/issues/258

c-cal avatar Jul 05 '22 15:07 c-cal

Fix this?

  • #111
  • #258

dklimpel avatar Jul 05 '22 16:07 dklimpel

The specification does not seem to forbid any characters for the local part of roomId (https://spec.matrix.org/v1.3/appendices/#room-ids-and-event-ids). However, it is the server that is responsible for generating this Id. Indeed, the endpoint to create a room does not take into account a possible roomId as parameter (https://spec.matrix.org/v1.3/client-server-api/#post_matrixclientv3createroom). And in the case of Synapse, the local part is only composed of alphabetical characters (https://github.com/matrix-org/synapse/blob/develop/synapse/handlers/room.py#L1167), unless you manually call the store_room() primitive. Despite issue #111, I don't see in which situation this can happen. Also I haven't located the Synapse code that takes care of unquote to know if all parameters extracted from an endpoint are processed or only some like userId...

So this PR currently fixes #258 but only partially #111

c-cal avatar Jul 05 '22 23:07 c-cal