!vcyiEtMVHIhWXcJAfl:sw1v.org

#synapse-dev:matrix.org

471 Members
If you are not a dev contributing code to Synapse, please talk in #synapse:matrix.org instead. This room is *only* for coordination of dev work. If you want to grab the attention of a dev, do it in #synapse:matrix.org. 142 Servers

Load older messages


SenderMessageTime
7 Jan 2025
@andrewm:element.ioAndrew Morgan (anoa) {he/him} [@ FOSDEM]ah, yeah. The official announcement's still to come.16:39:27
@andrewm:element.ioAndrew Morgan (anoa) {he/him} [@ FOSDEM]

hmm, that should generate a config file with a listener on port 1234. Are you also port forwarding to port 1234 when you run the container?

Also note that the better room for this would be #synapse:matrix.org

16:40:17
@andrewm:element.ioAndrew Morgan (anoa) {he/him} [@ FOSDEM]...unless you're using the docker image to develop Synapse, I guess 😅16:40:35
@reivilibre.element:librepush.netOlivier 'reivilibre'

Hi everyone. Synapse 1.122.0rc1 has just been released.

Please note that this version of Synapse drops support for PostgreSQL 11 and 12. The minimum version of PostgreSQL supported is now version 13.

notes | docker | debs | pypi

17:44:04
8 Jan 2025
@loic.le_guen:matrix.orgloic.le_guen joined the room.11:42:23
@loic.le_guen:matrix.orgloic.le_guen

Hi, I've recently come across a challenge regarding space privacy. Users from the same homeserver are allowed to see the membership list, even if they haven't joined the space. The goal is to have a public space with join rules set to "invite only," but with a hidden membership list for users who have not joined.

Regarding this issue, I started to dig a little at the source code of Synapse, specifically here at :

synapse/synapse/rest/client/room.py 

I found this specific section :

class RoomMemberListRestServlet(RestServlet):
    PATTERNS = client_patterns("/rooms/(?P<room_id>[^/]*)/members$", v1=True)
    CATEGORY = "Client API requests"

    def __init__(self, hs: "HomeServer"):
        super().__init__()
        self.message_handler = hs.get_message_handler()
        self.auth = hs.get_auth()
        self.store = hs.get_datastores().main

    @cancellable
    async def on_GET(
        self, request: SynapseRequest, room_id: str
    ) -> Tuple[int, JsonDict]:
        # TODO support Pagination stream API (limit/tokens)
        requester = await self.auth.get_user_by_req(request, allow_guest=True)
        handler = self.message_handler

        # request the state as of a given event, as identified by a stream token,
        # for consistency with /messages etc.
        # useful for getting the membership in retrospect as of a given /sync
        # response.
        at_token_string = parse_string(request, "at")
        if at_token_string is None:
            at_token = None
        else:
            at_token = await StreamToken.from_string(self.store, at_token_string)

        membership = parse_string(request, "membership")
        not_membership = parse_string(request, "not_membership")

        events = await handler.get_state_events(
            room_id=room_id,
            requester=requester,
            at_token=at_token,
            state_filter=StateFilter.from_types([(EventTypes.Member, None)]),
        )

        chunk = []

        for event in events:
            if (membership and event["content"].get("membership") != membership) or (
                not_membership and event["content"].get("membership") == not_membership
            ):
                continue
            chunk.append(event)

        return 200, {"chunk": chunk}

I wonder if it could be possible to introduce additional steps or checks before returning the membership data. For example, there might be an option to confirm whether the requesting user has the correct membership status to view the list. Or, maybe enforcing stricter checks so that only joined members see those details, or potentially add configuration flags that govern who can view membership data.

I’d be very interested in any feedback on whether this approach is consistent with Synapse’s principles.

Thanks for your help either way 🚀

11:49:26
@andrewm:element.ioAndrew Morgan (anoa) {he/him} [@ FOSDEM] loic.le_guen I'm not sure what you mean by "public space set to invite only". Room visibility permissions are set by the Matrix Spec; Synapse only implements them. A better room to discuss this in would be #matrix-spec:matrix.org 🙂 12:34:41
@loic.le_guen:matrix.orgloic.le_guen

Well it is just a public room with different join rule

My first steps were to make the create a public space, then i changed the join rule to invite only using this command :

curl -X PUT \
  -H "Authorization: Bearer $ADMIN_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "join_rule": "invite"
  }' \
  "https://homeserver/_matrix/client/v3/rooms/ROOMID/state/m.room.join_rules"

But the issue doesn't arise here, the issue is the membership list of a space than can be viewed by anyone, regardless if you joined or not the space

12:37:44
@andrewm:element.ioAndrew Morgan (anoa) {he/him} [@ FOSDEM] When you say "public", what do you mean? The join_rule, or the fact it's listed in the /publicRooms directory? 12:47:29
@loic.le_guen:matrix.orgloic.le_guenthe fact it's listed in the /publicRooms directoory, yes12:48:13
@loic.le_guen:matrix.orgloic.le_guen* the fact it's listed in the /publicRooms directory, yes12:48:43
@reivilibre.element:librepush.netOlivier 'reivilibre'presumably it is also world-readable?12:51:13
@andrewm:element.ioAndrew Morgan (anoa) {he/him} [@ FOSDEM]

So a user is allowed to see the membership list if:

  1. They are currently joined to the room (of course)
  2. They were joined to the room at some point (in which case they can see the membership list at the point in time they left)
  3. The room's history visibility setting is set to world_readable.
12:51:56
@reivilibre.element:librepush.netOlivier 'reivilibre' basically: in a world-readable room you can view all the memberships even if you're not in the room, is the 'problem', but it's according to spec.
I can see the idea behind what you're asking especially for spaces (since the members don't send any events into the room other than joining it), but I guess for normal rooms it's less likely to be relevant (since you can see who is in a room by the fact they sent a message etc)
12:53:19
@andrewm:element.ioAndrew Morgan (anoa) {he/him} [@ FOSDEM]

A room may appear in the public rooms list if it:

  1. Has its history visibility set to world_readable.
  2. Has a join_rule of public, knock, or knock_restricted.

The latter is so you can find rooms to knock on.

12:54:05
@loic.le_guen:matrix.orgloic.le_guen

Well actually the problem came when I tried to hide the membership list from outsiders by setting:

curl -X PUT \
  -H "Authorization: Bearer $ADMIN_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"history_visibility": "joined"}' \
  "https://HOMESERVER/_matrix/client/v3/rooms/ROOMID/state/m.room.history_visibility"

As soon as I did that, the space vanished from the public listing in Element, even though I still wanted it to remain discoverable. My main goal is to let people see that this space exists while ensuring they can’t see who’s in it unless they’re invited and become members.

12:57:51
@reivilibre.element:librepush.netOlivier 'reivilibre'yup, I can see what you want, but I think this is unachievable without spec changes12:58:20
@reivilibre.element:librepush.netOlivier 'reivilibre'

if you can see the events in a room(space), you can see the rooms within that space as well as the members in that space

If you can't see them, you can't see any. There's no in-between; both are considered events in the room history

12:58:59
@loic.le_guen:matrix.orgloic.le_guen

Thats why i was asked about the specs above in the source code of Synapse in

synapse/synapse/rest/client/room.py 

13:00:42
@reivilibre.element:librepush.netOlivier 'reivilibre' just so we're on the same page, by spec change I mean someone needs to create and have accepted a technical proposal to the Matrix spec https://spec.matrix.org/latest/
(See https://spec.matrix.org/proposals/ ; not sure where the best entrypoint is for this but it's likely to involve effort)
13:02:52
@loic.le_guen:matrix.orgloic.le_guenOh, i see...13:03:15
@clokep:matrix.orgclokepIt sounds like you want a room that can be knocked on? Which means people can see the room and can ask to join, but someone has to accept the join.13:04:01
@loic.le_guen:matrix.orgloic.le_guenSince I think my use case is quite narrow, I don't believe there's much chance my request will be considered over more important spec updates...13:04:42
@reivilibre.element:librepush.netOlivier 'reivilibre' I also agree that a knock is the best option today — people will be able to see the space exists and ask to join it, but they won't be able to see what's in the space before they've been accepted to join it 13:05:09
@loic.le_guen:matrix.orgloic.le_guenActually, yeah, I tried this as well, but it seems Element doesn't support it.13:05:21
@reivilibre.element:librepush.netOlivier 'reivilibre'
In reply to @loic.le_guen:matrix.org
Since I think my use case is quite narrow, I don't believe there's much chance my request will be considered over more important spec updates...
I think your use case is actually very reasonable and it's probably not the only time this will come up, but fair enough
13:05:49
@loic.le_guen:matrix.orgloic.le_guenI might try at least13:06:26
@loic.le_guen:matrix.orgloic.le_guenElement just lack the UI to support knock rooms actually13:07:16
@loic.le_guen:matrix.orgloic.le_guenthey where even design's proposed i saw on github13:07:37
@reivilibre.element:librepush.netOlivier 'reivilibre'ah rats sorry then, I thought they had it by now13:07:43

Show newer messages


Back to Room ListRoom Version: 9