Skip to content

Commit 122c803

Browse files
committed
Rework this (again) to remove the API based on conversations with the SCT.
1 parent b94d379 commit 122c803

File tree

1 file changed

+65
-154
lines changed

1 file changed

+65
-154
lines changed

proposals/3173-expose-stripped-state-events.md

Lines changed: 65 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,10 @@ the room in some situations:
1515
and [knocking users](https://github.com/matrix-org/matrix-doc/pull/2403)
1616
receive stripped state events to display metadata to users.
1717

18-
This MSC proposes allowing the stripped state events that are currently available
19-
to invited and knocking users to any user who could potentially join a room. It
20-
also consolidates the recommendation on which events to include as stripped state
21-
for potential joiners and provides a way to query for the stripped state directly.
22-
23-
This will allow for improved future use cases, such as:
24-
25-
* Improved user experience for more complicated access controls (e.g.
26-
[MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083)).
27-
* Showing a room preview on platforms when peeking fails (using for clients as
28-
well as matrix.to).
29-
* Joining by alias (e.g. as in Element) could show a room preview.
18+
This MSC proposes formalizing that the stripped state that is currently available
19+
to invited and knocking users is available to any user who could potentially join
20+
a room. It also defines "stripped state" and consolidates the recommendation on
21+
which events to include in the stripped state.
3022

3123
## Background
3224

@@ -76,176 +68,73 @@ recommends including the `m.room.create` event as one of the stripped state even
7668
7769
## Proposal
7870

79-
This proposal includes a few aspects which are dealt with separately:
80-
81-
1. Generalizing when a user is allowed to view the stripped state of a room.
82-
2. A consistent definition of stripped state and a recommendation for which
83-
events to include in the stripped state.
84-
3. Providing a dedicated API for accessing the stripped state of the room.
71+
The specification does not currently define what "stripped state" is or formally
72+
describe who can access it, instead it is specified that certain situations (e.g.
73+
an invite or knock) provide a potential joiner with the stripped state of a room.
8574

86-
### Accessing the stripped state of a room
87-
88-
Any user who is able to join a room shall be allowed to have access the stripped
89-
state events of that room. Additionally, any user who could access the state of
90-
a room may access the stripped state of a room, as it is a strict subset of
91-
information.
75+
This MSC clarifies what "stripped state" is and formalizes who can access the
76+
stripped state of a room in future cases.
9277

9378
Potential ways that a user might be able to join a room include, but are not
9479
limited to, the following mechanisms:
9580

9681
* A room that has `join_rules` set to `public` or `knock`.
9782
* A room that the user is in possession of an invite to (regardless of the `join_rules`).
9883

99-
Future MSCs might include additional mechanism for a user to join a room and
100-
should consider this MSC, for example:
84+
This MSC proposes a formal definition for the stripped state of a room<sup id="a1">[1](#f1)</sup>:
10185

102-
* [MSC3083: Restricting room membership based on space membership](https://github.com/matrix-org/matrix-doc/pull/3083)
103-
proposes allowing users to join a room based on their membership in a space (as defined in
104-
[MSC1772](https://github.com/matrix-org/matrix-doc/pull/1772)).
86+
> The stripped state of a room is a list of simplified state events to help a
87+
> potential joiner identify the room. These state events may only have the
88+
> `sender`, `type`, `state_key` and `content` keys present.
10589
106-
### Stripped state definitions and recommended events
90+
### Client behavior
10791

108-
It is also proposed to create a single definition of what the stripped state of
109-
a room is and for what events should be included in the stripped state to be
110-
potential joiners.
92+
These events do not replace any state that the client already has for the room,
93+
for example if the client has archived the room. Instead the client should keep
94+
two separate copies of the state: the one from the stripped state and one from the
95+
archived state. If the client joins the room then the current state will be given
96+
as a delta against the archived state not the stripped state.
11197

112-
The stripped state of a room is a list of simplified state events to help a
113-
potential joiner identify the room. These state events may only have the
114-
`sender`, `type`, `state_key` and `content` keys present. These events do not
115-
replace any state that the client already has for the room, for example if the
116-
client has archived the room.
98+
### Server behavior
11799

118-
It is recommended (although not required<sup id="a0">[0](#f0)</sup>) that
100+
It is recommended (although not required<sup id="a2">[2](#f2)</sup>) that
119101
homeserver implementations include the following events as part of the stripped
120102
state of a room:
121103

122-
* Create event (`m.room.create`)<sup id="a1">[1](#f1)</sup>
104+
* Create event (`m.room.create`)<sup id="a3">[3](#f3)</sup>
123105
* Join rules (`m.room.join_rules`)
124106
* Canonical alias (`m.room.canonical_alias`)
125107
* Room avatar (`m.room.avatar`)
126108
* Room name (`m.room.name`)
127-
* Encryption information (`m.room.encryption`)<sup id="a2">[2](#f2)</sup>
128-
* Room topic (`m.room.topic`)<sup id="a3">[3](#f3)</sup>
129-
130-
### Stripped state API
131-
132-
#### Client-server API
133-
134-
`GET /_matrix/client/r0/rooms/{roomIdOrAlias}/stripped_state`
135-
136-
A dedicated API is provided to query for the stripped state of a room. As
137-
described above, any potential joiner may access the stripped state of a room
138-
(and in the case of a room with `history_visibility: world_readable` -- anyone
139-
may access the stripped state, as it is a strict subset of the state).
140-
141-
This API is rate-limited and does not require authentication.
142-
143-
The request format follows [the `/state` endpoint](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-rooms-roomid-state),
144-
but with the addition of handling a `server_name` query parameter (as
145-
specified for [the `/join/{roomIdOrAlias}` endpoint](https://matrix.org/docs/spec/client_server/latest#post-matrix-client-r0-join-roomidoralias)).
146-
147-
The response body includes an array of `StrippedState`, as
148-
[described in the `/sync` response](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-sync).
149-
150-
If the homeserver does not know the state of the requested room it should use
151-
the corresponding federation API to request the stripped state from another
152-
homeserver.
153-
154-
TODO
155-
156-
##### Example request:
157-
158-
`GET /_matrix/client/r0/rooms/%21636q39766251%3Aexample.com/stripped_state HTTP/1.1`
159-
160-
##### Responses:
161-
162-
###### Status code 200:
163-
164-
The current stripped state of the room
165-
166-
```json
167-
[
168-
{
169-
"content": {
170-
"join_rule": "public"
171-
},
172-
"type": "m.room.join_rules",
173-
"sender": "@example:example.org",
174-
"state_key": ""
175-
},
176-
{
177-
"content": {
178-
"creator": "@example:example.org",
179-
"room_version": "1",
180-
"m.federate": true,
181-
"predecessor": {
182-
"event_id": "$something:example.org",
183-
"room_id": "!oldroom:example.org"
184-
}
185-
},
186-
"type": "m.room.create",
187-
"sender": "@example:example.org",
188-
"state_key": ""
189-
}
190-
]
191-
```
192-
193-
Note that this is the same example as [the `/state` endpoint](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-rooms-roomid-state),
194-
but limited to what would be returned as stripped state.
195-
196-
###### Status code 403:
197-
198-
You are not a member of the room, a potential joiner, and the room is not publicly viewable.
199-
200-
#### Server-server API
201-
202-
`GET /_matrix/federation/v1/stripped_state/{roomId}`
203-
204-
Retrieve the stripped state of a room, this is essentially identical to the
205-
client-server API, but will not reach out over federation.
206-
207-
Path parameters:
208-
209-
* `roomId` - **Required.** The room ID to get state for.
210-
211-
Response format:
212-
213-
* `stripped_state` - `[StrippedState]` A list of simplified events to help identify the room.
214-
215-
The form of `StrippedState` is as defined in
216-
[the `/invite/{roomId}/{eventId}` endpoint](https://matrix.org/docs/spec/server_server/latest#put-matrix-federation-v2-invite-roomid-eventid).
217-
218-
The stripped state should be returned to the requesting server if the host has
219-
a potential joiner, e.g. if the room has `join_rules` set to `public` or any
220-
user on the request server is in possession of an invite to the room. The
221-
requesting server is responsible for filtering the returned data to the client.
109+
* Encryption information (`m.room.encryption`)<sup id="a4">[4](#f4)</sup>
110+
* Room topic (`m.room.topic`)<sup id="a5">[5](#f5)</sup>
222111

223112
## Potential issues
224113

225-
This is a generalization of current behavior and shouldn't introduce any new issues.
114+
This is a formalization of current behavior and should not introduce new issues.
226115

227116
## Alternatives
228117

229-
A different approach to this would be to separately specify each situation in which
230-
a user is allowed to see stripped state events, as we do currently for invites and
231-
knocking.
118+
A different approach would be to continue with what is done today for invites,
119+
knocking, the room directory: separately specify that a user is allowed to see
120+
the stripped state (and what events the stripped state should contain).
232121

233122
## Security considerations
234123

235124
This would allow for invisibly accessing the stripped state of a room with `public`
236125
or `knock` join rules.
237126

238127
In the case of a public room, if the room has `history_visibility` set to `world_readable`
239-
then this is no change. Otherwise, it is trivial to access the state of the room
240-
by joining, but currently users in the room would know that the join occurred.
241-
Additionally, this information is already provided by the room directory (if
242-
the room is listed there).
128+
then this is no change. Additionally, this information is already provided by the
129+
room directory (if the room is listed there). Otherwise, it is trivial to access
130+
the state of the room by joining, but currently users in the room would know
131+
that the join occurred.
243132

244133
Similarly, in the case of knocking, a user is able to trivially access the
245134
stripped state of the room by knocking, but users in the room would know that
246135
the knock occurred.
247136

248-
This does not seem to be weakening the security expectations of either join rule.
137+
This does not seem to weaken the security expectations of either join rule.
249138

250139
## Future extensions
251140

@@ -256,11 +145,27 @@ in the [room directory](https://matrix.org/docs/spec/client_server/latest#get-ma
256145
The main missing piece seems to be the encryption information, but there may also
257146
be other pieces of information to include.
258147

148+
### Additional ways to access the stripped state
149+
150+
[MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946) proposes including
151+
the stripped state in the spaces summary. Not needing to rationalize what state
152+
can be included for a potential joiner would simplify this (and future) MSCs.
153+
259154
### Additional ways to join a room
260155

261-
[MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083) leverages this to
262-
expose the information available in stripped state events via the spaces summary
263-
for potential joiners due to membership in a space.
156+
[MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083) proposes a new
157+
join rule due to membership in a space. This MSC would clarify that the stripped
158+
state of a room is available to those joiners.
159+
160+
### Dedicated API for accessing the stripped state
161+
162+
Dedicated client-server and server-server APIs could be added to request the
163+
stripped state events, but that is considered out-of-scope for the current
164+
proposal.
165+
166+
This API would allow any potential joiner to query for the stripped state. If
167+
the server does not know the room's state it would need to query other servers
168+
for it.
264169

265170
## Unstable prefix
266171

@@ -271,17 +176,23 @@ for potential joiners due to membership in a space.
271176

272177
## Footnotes
273178

274-
<a id="f0"/>[0]: Privacy conscious deployments may wish to limit the metadata
179+
<a id="f1"/>[1]: No changes are proposed to
180+
[the definition of `history_visibility`](https://matrix.org/docs/spec/client_server/latest#room-history-visibility).
181+
The state of a room which is `world_readable` is available to anyone. This somewhat
182+
implies that the stripped state is also available to anyone, regardless of the join
183+
rules, but having a `world_readable`, `invite` room does not seem valuable. [](#a1)
184+
185+
<a id="f2"/>[2]: Privacy conscious deployments may wish to limit the metadata
275186
available to users who are not in a room as the trade-off against user experience.
276-
There seems to be no reason to not allow this. [](#a0)
187+
There seems to be no reason to not allow this. [](#a2)
277188

278-
<a id="f1"/>[1]: As updated in [MSC1772](https://github.com/matrix-org/matrix-doc/pull/1772). [](#a1)
189+
<a id="f3"/>[3]: As updated in [MSC1772](https://github.com/matrix-org/matrix-doc/pull/1772). [](#a3)
279190

280-
<a id="f2"/>[2]: The encryption information (`m.room.encryption`) is already sent
191+
<a id="f4"/>[4]: The encryption information (`m.room.encryption`) is already sent
281192
from Synapse and generally seems useful for a user to know before joining a room.
282-
[](#a2)
193+
[](#a4)
283194

284-
<a id="f3"/>[3]: The room topic (`m.room.topic`) is included as part of the
195+
<a id="f5"/>[5]: The room topic (`m.room.topic`) is included as part of the
285196
[room directory](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-publicrooms)
286197
response for public rooms. It is also planned to be included as part of [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946)
287-
in the spaces summary response. [](#a3)
198+
in the spaces summary response. [](#a5)

0 commit comments

Comments
 (0)