-
Notifications
You must be signed in to change notification settings - Fork 415
MSC4319: Room member events in stripped state #4319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,181 @@ | ||||||
| # MSC4139: Room member events in stripped state | ||||||
|
|
||||||
| In the Client-Server API, the response of the [`GET /sync`](https://spec.matrix.org/v1.15/client-server-api/#get_matrixclientv3sync) | ||||||
| endpoint, the `events` array in the `invite_state` for rooms under `invite` and in the `knock_state` | ||||||
| for rooms under `knock` are defined as containing the stripped state of the room. | ||||||
|
|
||||||
| This stripped state comes over federation, via the | ||||||
| [`PUT /invite`](https://spec.matrix.org/v1.15/server-server-api/#put_matrixfederationv2inviteroomideventid) | ||||||
| and [`PUT /send_knock`](https://spec.matrix.org/v1.15/server-server-api/#put_matrixfederationv1send_knockroomideventid) | ||||||
| endpoints in the Server-Server API. | ||||||
|
|
||||||
| In the definition of the [stripped state](https://spec.matrix.org/v1.15/client-server-api/#stripped-state) | ||||||
| it is recommended to contain the following state events: | ||||||
|
|
||||||
| - `m.room.create` | ||||||
| - `m.room.name` | ||||||
| - `m.room.avatar` | ||||||
| - `m.room.topic` | ||||||
| - `m.room.join_rules` | ||||||
| - `m.room.canonical_alias` | ||||||
| - `m.room.encryption` | ||||||
|
|
||||||
| Although these events are useful to be able to present information about the room, they don't | ||||||
| contain information about the event itself. | ||||||
zecakeh marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| The following information can be useful for clients: | ||||||
|
|
||||||
| - The sender of the invite, including their display name and avatar, to present to the user. | ||||||
| - The time of the invite or knock, to present to the user. | ||||||
| - Whether an invite event was preceded by a knock, if the client wants to auto-accept invites that | ||||||
| come from knocking. | ||||||
|
|
||||||
| Furthermore, appservices may want to deduplicate this event received via `/sync` from events | ||||||
| received via `/_matrix/app/v1/transactions`, so they need to be able to identify it uniquely. The | ||||||
| easiest way to do this is to use its `event_id`. | ||||||
|
|
||||||
| > [!NOTE] | ||||||
| > Part of this proposed change is based on behavior that has been implemented for a long time in | ||||||
| > homeserver implementations and that clients already rely on, but that is currently unspecced. | ||||||
|
|
||||||
|
|
||||||
| ## Proposal | ||||||
|
|
||||||
| For clients to be able to get all the details about an invite or knock, a `state` key is added to | ||||||
| the [`InvitedRoom`](https://spec.matrix.org/v1.15/client-server-api/#get_matrixclientv3sync_response-200_invited-room) | ||||||
| and [`KnockedRoom`](https://spec.matrix.org/v1.15/client-server-api/#get_matrixclientv3sync_response-200_knocked-room) | ||||||
| objects. It uses the same format as the [`State`](https://spec.matrix.org/v1.15/client-server-api/#get_matrixclientv3sync_response-200_state) | ||||||
| object in [`JoinedRoom`](https://spec.matrix.org/v1.15/client-server-api/#get_matrixclientv3sync_response-200_joined-room) | ||||||
| and MUST include the `m.room.member` event that was created during the invite or knock process, in | ||||||
| the [`ClientEventWithoutRoomID`](https://spec.matrix.org/v1.15/client-server-api/#get_matrixclientv3sync_response-200_clienteventwithoutroomid) | ||||||
| format. | ||||||
|
|
||||||
| > [!NOTE] | ||||||
| > Making it mandatory makes sense because this event is the reason why the room appears in `invite` | ||||||
| > or `knock` in the first place. Providing the full event format allows clients to access details | ||||||
| > like the `origin_server_ts`, the `event_id` or the `unsigned` object. | ||||||
|
|
||||||
| For compatibility with the current client implementations, homeservers SHOULD also include this | ||||||
| event in the `events` array of the `invite_state` or `knock_state` in stripped format. | ||||||
|
|
||||||
| Clients SHOULD expect the `state` key to be missing and SHOULD look for the `m.room.member` event in | ||||||
| `invite_state` or `knock_state` as a fallback. | ||||||
|
Comment on lines
+58
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. per my comment on the other thread, this feels a bit weak, and is just propagating the status quo. |
||||||
|
|
||||||
| > [!NOTE] | ||||||
| > The example for the response of `GET /sync` already includes the stripped `m.room.member` event | ||||||
| > although it is not specified. | ||||||
|
|
||||||
| Finally, the list of events that should be included in the stripped state is extended with the | ||||||
| stripped `m.room.member` event of the `sender` of the invite. This allows clients to be able to | ||||||
| display information about the sender of an invite, like their display name or avatar. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In federation contexts, I don't think the server has the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The list of events that should be included in the stripped state in the spec applies to the CS and SS APIs alike. This is asking for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, I see, right. It would probably be good to clarify that in the MSC text. |
||||||
|
|
||||||
| Example of an `InvitedState` object: | ||||||
|
|
||||||
| ```json | ||||||
| { | ||||||
| "state": { | ||||||
| "events": [ | ||||||
| { | ||||||
| "content": { | ||||||
| "membership": "invite", | ||||||
| "displayname": "Alice" | ||||||
| }, | ||||||
| "type": "m.room.member", | ||||||
| "state_key": "@alice:example.org", | ||||||
| "sender": "@bob:example.org", | ||||||
| "event_id": "$Rqnc-F-dvnEYJTyHq_iKxU2bZ1CI92-kuZq3a5lr5Zg", | ||||||
| "origin_server_ts": 1432735824653, | ||||||
| "unsigned": { | ||||||
| "prev_content": { | ||||||
| "membership": "knock", | ||||||
| "displayname": "Alice" | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| ] | ||||||
| }, | ||||||
| "invite_state": { | ||||||
| "events": [ | ||||||
| { | ||||||
| "content": { | ||||||
| "membership": "invite", | ||||||
| "displayname": "Alice" | ||||||
| }, | ||||||
| "type": "m.room.member", | ||||||
| "state_key": "@alice:example.org", | ||||||
| "sender": "@bob:example.org", | ||||||
| }, | ||||||
| { | ||||||
| "content": { | ||||||
| "m.federate": true, | ||||||
| "predecessor": { | ||||||
| "event_id": "$something:example.org", | ||||||
| "room_id": "!oldroom:example.org" | ||||||
| }, | ||||||
| "room_version": "11" | ||||||
| }, | ||||||
| "sender": "@example:example.org", | ||||||
| "state_key": "", | ||||||
| "type": "m.room.create", | ||||||
| }, | ||||||
| { | ||||||
| "content": { | ||||||
| "membership": "join", | ||||||
| "displayname": "Bob" | ||||||
| }, | ||||||
| "type": "m.room.member", | ||||||
| "state_key": "@bob:example.org", | ||||||
| "sender": "@bob:example.org", | ||||||
| }, | ||||||
| ] | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
|
|
||||||
| ## Potential issues | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clients have depended on synapse's behaviour of including the full client formatted event for the the-draupnir-project/Draupnir#945 In draupnir this dependency is more than just a parsing issue. The matrix-protection-suite provides a handle called Deduplication and buffering is then coordinated using the event id as it is identical to any other client formatted event and not special cased. So this is a deep dependency. https://github.com/Gnuxie/matrix-protection-suite/blob/a85102c0aaa6ba73beae8fdb35600eec0999eada/src/Protection/Protection.ts#L176 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change complicates clients that allow either There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, the appservice event can't be stripped, because then you'd have two different data formats in the In this specific context, the AS API is closer to S-S than C-S /sync, as both AS and S-S send full invite events with stripped state in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have changed the proposal in 1b81df4 to send the full event in a different place to attempt to take care of two concerns at once: the event formats should not be mixed in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It feels like including the event in stripped format in I think I'd suggest a fairly aggressive timeline like
Interested to hear thoughts from others on this, though |
||||||
|
|
||||||
| This changes the current expectations of clients by moving the `m.room.member` event outside of the | ||||||
| `invite_state` and `knock_state` so they will need to adapt to the change. This is mitigated by | ||||||
| encouraging servers are to keep sending the event in these objects. | ||||||
|
|
||||||
| By showing more information about the sender of an invite, users might be subject to undesirable | ||||||
| content like abusive language or images. Mitigating this is out of scope of this MSC, and other MSCs | ||||||
| exist for this, like [MSC4278](https://github.com/matrix-org/matrix-spec-proposals/pull/4278). | ||||||
|
|
||||||
|
|
||||||
| ## Alternatives | ||||||
|
|
||||||
| We could put the full `m.room.member` event in the `events` array of the `invite_state` or | ||||||
| `knock_state`, but mixing event formats in a list is undesirable. | ||||||
|
|
||||||
| We could put the full `m.room.member` event under another key in the `invite_state` or | ||||||
| `knock_state`, the `state` key was chosen for its similarity with other room objects. It will also | ||||||
| allow to add more events using their full format in the future if needed. | ||||||
|
|
||||||
| We could add more fields to the stripped state format, but given all the fields that are needed for | ||||||
| the different use cases, it would mean that the stripped state has the same format as normal state. | ||||||
| Using the full event format might give the wrong idea that this state has been validated by the | ||||||
| homeserver, which is currently not possible | ||||||
| (see [this discussion in MSC4311](https://github.com/matrix-org/matrix-spec-proposals/pull/4311#discussion_r2274781824)). | ||||||
| Besides, those fields are really only necessary for the `invite` or `knock` `m.room.member` event. | ||||||
|
|
||||||
| This doesn't solve the case where a room doesn't an `m.room.name` or `m.room.canonical_alias` state | ||||||
| event, so [its display name should be computed using the room summary](https://spec.matrix.org/v1.15/client-server-api/#calculating-the-display-name-for-a-room). | ||||||
| This is left to another MSC. | ||||||
|
|
||||||
|
|
||||||
| ## Security considerations | ||||||
|
|
||||||
| No potential security issues are known to the author. | ||||||
|
|
||||||
|
|
||||||
| ## Unstable prefix | ||||||
|
|
||||||
| While this proposal is not considered stable, implementations should use `org.matrix.msc4319.state` | ||||||
| for the `state` key in `InvitedRoom` and `JoinedRoom`. | ||||||
|
|
||||||
|
|
||||||
| ## Dependencies | ||||||
|
|
||||||
| None. | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It strikes me that the current proposal is not really "Room member events in stripped state"; rather, it is "add new fields [which are independent of stripped state] to the
/syncresponse".