2021-05-03 19:37:04 +02:00
# MSC3173: Expose stripped state events to any potential joiner
2021-05-03 18:47:44 +02:00
2021-05-17 17:30:26 +02:00
The current design of Matrix somtimes allows for inspecting part of the room state
without being joined to the room:
2021-05-03 18:47:44 +02:00
2021-05-17 16:53:16 +02:00
* If the room has `history_visibility: world_readable` , then anyone can inspect
it (by calling `/state` on it).
2021-05-17 17:30:26 +02:00
* Rooms in the [room directory ](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-publicrooms )
expose some of their state publicly.
2021-05-17 16:53:16 +02:00
* [Invited users ](https://matrix.org/docs/spec/server_server/r0.1.4#put-matrix-federation-v2-invite-roomid-eventid )
2021-05-17 17:30:26 +02:00
and [knocking users ](https://github.com/matrix-org/matrix-doc/pull/2403 )
receive stripped state events to display metadata to users.
2021-05-03 18:47:44 +02:00
2021-05-17 17:30:26 +02:00
This MSC proposes allowing the stripped state events that are currently available
2021-05-03 19:49:17 +02:00
to invited and knocking users to any user who could potentially join a room. It
2021-05-18 19:22:33 +02:00
also consolidates the recommendation on which events to include as stripped state
for potential joiners.
2021-05-03 18:47:44 +02:00
## Background
2021-05-03 19:49:17 +02:00
When creating an invite it is [currently recommended ](https://matrix.org/docs/spec/server_server/r0.1.4#put-matrix-federation-v2-invite-roomid-eventid )
to include stripped state events which are useful for displaying the invite to a user:
2021-05-03 18:47:44 +02:00
2021-05-03 19:49:17 +02:00
> An optional list of simplified events to help the receiver of the invite identify
> the room. The recommended events to include are the join rules, canonical alias,
> avatar, and name of the room.
2021-05-03 18:47:44 +02:00
2021-05-03 19:49:17 +02:00
The invited user receives these [stripped state events ](https://spec.matrix.org/unstable/client-server-api/#get_matrixclientr0sync )
as part of the `/sync` response:
2021-05-03 18:47:44 +02:00
2021-05-03 19:49:17 +02:00
> The state of a room that the user has been invited to. These state events may
> only have the `sender`, `type`, `state_key` and `content` keys present. These
> events do not replace any state that the client already has for the room, for
> example if the client has archived the room.
2021-05-03 18:47:44 +02:00
2021-05-03 19:49:17 +02:00
These are sent as part of the [`unsigned` content of the `m.room.member` event ](https://spec.matrix.org/unstable/client-server-api/#mroommember )
containing the invite.
2021-05-03 18:47:44 +02:00
2021-05-03 19:49:17 +02:00
[MSC2403: Add "knock" feature ](https://github.com/matrix-org/matrix-doc/pull/2403 )
extends this concept to also include the stripped state events in the `/sync` response
for knocking users:
2021-05-03 18:47:44 +02:00
2021-05-03 19:49:17 +02:00
> It is proposed to add a fourth possible key to rooms, called `knock`. Its value
> is a mapping from room ID to room information. The room information is a mapping
> from a key `knock_state` to another mapping with key events being a list of
> `StrippedStateEvent`.
2021-05-03 18:47:44 +02:00
It is also provides an extended rationale of why this is useful:
2021-05-03 19:49:17 +02:00
> These stripped state events contain information about the room, most notably the
2021-05-12 14:56:38 +02:00
> room's name and avatar. A client will need this information to show a nice
2021-05-03 19:49:17 +02:00
> representation of pending knocked rooms. The recommended events to include are the
> join rules, canonical alias, avatar, name and encryption state of the room, rather
> than all room state. This behaviour matches the information sent to remote
> homeservers when remote users are invited to a room.
2021-05-03 18:47:44 +02:00
2021-05-03 19:49:17 +02:00
[MSC1772: Spaces ](https://github.com/matrix-org/matrix-doc/pull/1772 ) additionally
recommends including the `m.room.create` event as one of the stripped state events:
2021-05-03 18:47:44 +02:00
2021-05-12 14:56:38 +02:00
> Join rules, invites and 3PID invites work as for a normal room, with the exception
2021-05-03 19:49:17 +02:00
> that `invite_state` sent along with invites should be amended to include the
2021-05-12 14:56:38 +02:00
> `m.room.create` event, to allow clients to discern whether an invite is to a
2021-05-03 19:49:17 +02:00
> space-room or not.
2021-05-03 18:47:44 +02:00
## Proposal
2021-05-18 19:22:33 +02:00
This proposal includes two aspects which are dealt with separately:
1. Generalizing when a user is allowed to view the stripped state of a room.
2. A consistent recommendation for which events to include in the stripped state.
### Accessing the stripped state of a room
2021-05-17 17:30:26 +02:00
Any user who is able to join a room shall be allowed to have access the stripped
state events of that room. No changes are proposed to the mechanics of how the
2021-05-18 19:22:33 +02:00
users may get those state events.
2021-05-03 18:47:44 +02:00
2021-05-17 17:30:26 +02:00
Potential ways that a user might be able to join a room include, but are not
limited to, the following mechanisms:
2021-05-03 18:47:44 +02:00
2021-05-12 16:30:40 +02:00
* A room that has `join_rules` set to `public` or `knock` .
2021-05-03 18:47:44 +02:00
* A room that the user is in possession of an invite to (regardless of the `join_rules` ).
2021-05-12 14:56:38 +02:00
Future MSCs might include additional mechanism for a user to join a room and
2021-05-03 19:49:17 +02:00
should consider this MSC, for example:
2021-05-03 18:47:44 +02:00
2021-05-17 16:53:16 +02:00
* [MSC3083: Restricting room membership based on space membership ](https://github.com/matrix-org/matrix-doc/pull/3083 )
proposes allowing users to join a room based on their membership in a space (as defined in
[MSC1772 ](https://github.com/matrix-org/matrix-doc/pull/1772 )).
2021-05-03 18:47:44 +02:00
2021-05-18 19:22:33 +02:00
### Events to include in the stripped state
2021-05-17 17:30:26 +02:00
It is also proposed to create a single definition for what stripped state events
should be provided to be potential joiners. Thus, it is recommended (although not
required< sup id = "a0" > [0](#f0)< / sup > ) that homeserver implementations include the
following as stripped state events:
2021-05-03 18:47:44 +02:00
2021-05-17 17:14:29 +02:00
* Create event (`m.room.create`)< sup id = "a1" > [1](#f1)</ sup >
2021-05-03 18:47:44 +02:00
* Join rules (`m.room.join_rules`)
* Canonical alias (`m.room.canonical_alias`)
* Room avatar (`m.room.avatar`)
* Room name (`m.room.name`)
2021-05-17 17:14:29 +02:00
* Encryption information (`m.room.encryption`)< sup id = "a2" > [2](#f2)</ sup >
* Room topic (`m.room.topic`)< sup id = "a3" > [3](#f3)</ sup >
2021-05-03 18:47:44 +02:00
## Potential issues
This is a generalization of current behavior and shouldn't introduce any new issues.
## Alternatives
2021-05-03 19:49:17 +02:00
A different approach to this would be to separately specify each situation in which
a user is allowed to see stripped state events, as we do currently for invites and
knocking.
2021-05-03 18:47:44 +02:00
## Security considerations
2021-05-12 16:30:40 +02:00
This would allow for invisibly accessing the stripped state of a room with `knock`
join rules. This is already trivially accessible by knocking on the room, but
currently users in the room would know that the knock occurred. This does not
seem to be a major weakening of the security.
2021-05-03 18:47:44 +02:00
## Future extensions
2021-05-17 17:30:26 +02:00
### Dedicated APIs
2021-05-03 19:49:17 +02:00
Dedicated client-server and server-server APIs could be added to request the
stripped state events, but that is considered out-of-scope for the current
proposal.
2021-05-03 18:47:44 +02:00
2021-05-17 17:30:26 +02:00
### Revisions to the room directory
A future MSC could include additional information from the stripped state events
in the [room directory ](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-publicrooms ).
This seems to mostly be the encryption information, but there may also be other
pieces of information to include.
### Additional ways to join a room
[MSC3083 ](https://github.com/matrix-org/matrix-doc/pull/3083 ) leverages this to
expose the information available in stripped state events via the spaces summary
for potential joiners due to membership in a space.
2021-05-03 18:47:44 +02:00
## Unstable prefix
N/A
## Footnotes
2021-05-17 17:30:26 +02:00
< a id = "f0" / > [0]: Privacy conscious deployments may wish to limit the metadata
available to users who are not in a room as the trade-off against user experience.
There seems to be no reason to not allow this. [↩ ](#a0 )
2021-05-17 17:14:29 +02:00
< a id = "f1" /> [1]: As updated in [MSC1772 ](https://github.com/matrix-org/matrix-doc/pull/1772 ). [↩ ](#a1 )
2021-05-03 18:47:44 +02:00
2021-05-17 17:14:29 +02:00
< a id = "f2" / > [2]: The encryption information (`m.room.encryption`) is already sent
from Synapse and generally seems useful for a user to know before joining a room.
[↩ ](#a2 )
< a id = "f3" / > [3]: The room topic (`m.room.topic`) is included as part of the
[room directory ](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-publicrooms )
2021-05-17 17:37:11 +02:00
response for public rooms. It is also planned to be included as part of [MSC2946 ](https://github.com/matrix-org/matrix-doc/pull/2946 )
2021-05-17 17:14:29 +02:00
in the spaces summary response. [↩ ](#a3 )