Skip to content

Commit dfcd8b9

Browse files
committed
MSC4366: Resident servers in and around the room directory
Signed-off-by: Johannes Marbach <[email protected]>
1 parent 55ec009 commit dfcd8b9

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# MSC4366: Resident servers in and around the room directory
2+
3+
The [published room directory] allows clients to discover rooms on their own or other homeservers.
4+
Naturally, clients will want to join rooms found in the directory which requires knowledge of a
5+
resident server to facilitate the join. The spec doesn't make it clear how to find such a server,
6+
however.
7+
8+
To begin with, it is unclear whether the endpoints for listing a server's directory may return rooms
9+
that the server is not joined to. Additionally, there is no recommendation on what `via` parameter
10+
clients should use when attempting to join rooms found in the directory. As a result, clients can
11+
end up browsing published rooms without being able to join them.[^1]
12+
13+
This proposal addresses the situation by forbidding non-resident rooms in local directory queries
14+
and matching the `server` and `via` query parameters.
15+
16+
## Proposal
17+
18+
When either of the client-server endpoints
19+
20+
- [`GET /_matrix/client/v3/publicRooms`]
21+
- [`POST /_matrix/client/v3/publicRooms`]
22+
23+
is called with an empty or missing `server` parameter, the server MUST only return rooms listed on
24+
its directory that it has at least one joined member in.
25+
26+
Similarly, the server-server endpoints
27+
28+
- [`GET /_matrix/federation/v1/publicRooms`]
29+
- [`POST /_matrix/federation/v1/publicRooms`]
30+
31+
MUST only include rooms from the server's local directory if the server has at least one joined
32+
member in them.
33+
34+
Clients that use the `server` parameter on room directory queries and subsequently call
35+
[`POST /_matrix/client/v3/join/{roomIdOrAlias}`] to join a room found in the response, SHOULD
36+
include the same server name in the `via` parameter.
37+
38+
Together, the changes above increase the chances that clients can actually join rooms found in the
39+
directory.
40+
41+
## Potential issues
42+
43+
As per the current [spec], the server-server endpoints are discouraged but not banned from including
44+
rooms listed on *other* homeserver's directories. A client querying `/publicRooms` with a specific
45+
`server` may, therefore, still receive rooms which that server isn't joined to. Matching the
46+
`server` and `via` parameters as described in this proposal would still not allow clients to join
47+
these rooms. This problem already exists today, however, and is deemed out of scope for this
48+
proposal.
49+
50+
## Alternatives
51+
52+
Non-resident rooms could be allowed in room directory responses if the server would accompany them
53+
with suitable `via` values. It is unclear, however, how the server would reliably determine other
54+
resident servers to provide these values. A future proposal might investigate this idea further.
55+
56+
## Security considerations
57+
58+
None.
59+
60+
## Unstable prefix
61+
62+
None.
63+
64+
## Dependencies
65+
66+
None.
67+
68+
[^1]: These issues were initially raised in <https://github.com/matrix-org/matrix-spec/issues/1375>.
69+
70+
[published room directory]: https://spec.matrix.org/v1.16/client-server-api/#published-room-directory
71+
[`GET /_matrix/client/v3/publicRooms`]: https://spec.matrix.org/v1.16/client-server-api/#get_matrixclientv3publicrooms
72+
[`POST /_matrix/client/v3/publicRooms`]: https://spec.matrix.org/v1.16/client-server-api/#post_matrixclientv3publicrooms
73+
[`GET /_matrix/federation/v1/publicRooms`]: https://spec.matrix.org/v1.16/server-server-api/#get_matrixfederationv1publicrooms
74+
[`POST /_matrix/federation/v1/publicRooms`]: https://spec.matrix.org/v1.16/server-server-api/#post_matrixfederationv1publicrooms
75+
[`POST /_matrix/client/v3/join/{roomIdOrAlias}`]: https://spec.matrix.org/v1.16/client-server-api/#post_matrixclientv3joinroomidoralias
76+
[spec]: https://spec.matrix.org/v1.16/server-server-api/#published-room-directory

0 commit comments

Comments
 (0)