Skip to content
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

Room versions 8 and 9: Restricted rooms #3387

Merged
merged 24 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e650fca
Room versions 8 and 9: Restricted rooms
turt2live Sep 8, 2021
7a5e820
Changelogs
turt2live Sep 8, 2021
3769724
Capitalization
turt2live Sep 8, 2021
f7f2ea8
Remove verbiage for spaces because they don't exist
turt2live Sep 8, 2021
2ccae80
Iterations on text
turt2live Sep 8, 2021
e3b7735
Merge remote-tracking branch 'origin/travis/spec/v8-v9' into travis/s…
turt2live Sep 8, 2021
db2a738
Another clarification
turt2live Sep 8, 2021
c613d2e
Make error code descriptions consistent
turt2live Sep 24, 2021
d521f25
Merge remote-tracking branch 'origin/main' into travis/spec/v8-v9
turt2live Sep 24, 2021
b31298d
Apply suggestions from code review
turt2live Sep 28, 2021
9c18649
Merge branch 'main' into travis/spec/v8-v9
turt2live Dec 28, 2021
b04da31
Incorporate from merge
turt2live Dec 28, 2021
17954df
Misc language update per review
turt2live Dec 28, 2021
75fc992
Update accuracy before splitting auth rules
turt2live Dec 28, 2021
44fc526
fix wtf moment
turt2live Dec 28, 2021
3447b12
Fix up v8 and v9 to match "fully specify room versions"
turt2live Dec 28, 2021
a8fa47f
Scope auth events selection to room version
turt2live Dec 28, 2021
157f750
Apply consistency
turt2live Dec 29, 2021
42195ca
Add changelogs
turt2live Dec 29, 2021
56bf4a4
Review part 1
turt2live Jan 10, 2022
245cc17
Apply suggestions from code review
turt2live Jan 10, 2022
fd82238
Split out redaction sections
turt2live Jan 10, 2022
cc65d8a
Clarify general case of join conditions
turt2live Jan 18, 2022
e58bc1b
Update diagram
turt2live Jan 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions content/client-server-api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1748,11 +1748,11 @@ This room can only be joined if you were invited, and allows anyone to
request an invite to the room. Note that this join rule is only available
in room versions [which support knocking](/rooms/#feature-matrix).

`restricted`
{{% added-in v="1.2" %}} `restricted`
This room can be joined if you were invited or if you are a member of another
turt2live marked this conversation as resolved.
Show resolved Hide resolved
room listed in the join rules. If the server cannot verify membership for any
of the listed rooms then you can only join with an invite. Note that this join
rule is only available in room versions [which support it](/rooms/#feature-matrix).
of the listed rooms then you can only join with an invite. Note that this rule
is only expected to work in room versions [which support it](/rooms/#feature-matrix).

The allowable state transitions of membership are:

Expand Down Expand Up @@ -1805,6 +1805,8 @@ server chose to auto-accept.

##### Restricted rooms

{{% added-in v="1.2" %}}

Restricted rooms are rooms with a `join_rule` of `restricted`. These rooms
turt2live marked this conversation as resolved.
Show resolved Hide resolved
are accompanied by "allow conditions" as described in the
[`m.room.join_rules`](#mroomjoin_rules) state event.
Expand All @@ -1820,9 +1822,10 @@ before accepting the join. See the [Server-Server Spec](/server-server-api/#rest
for more information.

If the room is `restricted` but no valid conditions are presented then the
room is effectively invite only. The user does not need to maintain the
conditions in order to stay a member of the room: the conditions are only
checked/evaluated during the join process.
room is effectively invite only.

The user does not need to maintain the conditions in order to stay a member
of the room: the conditions are only checked/evaluated during the join process.

###### Conditions

Expand Down
2 changes: 1 addition & 1 deletion content/rooms/fragments/v8-auth-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The rules are as follows:
reject.
4. If type is `m.room.member`:
1. If no `state_key` key or `membership` key in `content`, reject.
2. If `content` has `join_authorised_via_users_server`
2. If `content` has a `join_authorised_via_users_server`
key:
1. If the event is not validly signed by the user ID denoted
by the key, reject.
Expand Down
6 changes: 4 additions & 2 deletions content/rooms/v7.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ completeness.

{{% rver-fragment name="v4-event-format" %}}

### Handling redactions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd be nice if we could figure out what order these things go in (in v5 'Handling redactions' is before 'Event IDs' and 'Event format'), but I guess I'm just nit-picking really.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they're supposed to be consistent, but that ship sailed when I thought they were consistent last time. Will attempt to fix in a future PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


{{% rver-fragment name="v3-handling-redactions" %}}

### Canonical JSON

{{% rver-fragment name="v6-canonical-json" %}}
Expand All @@ -209,6 +213,4 @@ completeness.

### Redactions

{{% rver-fragment name="v3-handling-redactions" %}}

{{% rver-fragment name="v6-redactions" %}}
56 changes: 31 additions & 25 deletions content/rooms/v8.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,9 @@ The new join rule, `restricted`, is described in the
Clients which implement the redaction algorithm locally should refer to the
[redactions](#redactions) section below for a full overview.

## Server implementation components

{{% boxes/warning %}}
The information contained in this section is strictly for server
implementors. Applications which use the Client-Server API are generally
unaffected by the intricacies contained here. The section above
regarding client considerations is the resource that Client-Server API
use cases should reference.
{{% /boxes/warning %}}

Room version 8 adds a new join rule to allow members of a room to join another
room without invite. Otherwise, the room version inherits all properties of
[Room version 7](/rooms/v7).

### Authorization rules

{{% added-in this=true %}} For checks performed upon `m.room.member` events, new
points for handling `content.join_authorised_via_users_server` are added (Rule 4.2
and 4.3.5).

{{% rver-fragment name="v8-auth-rules" %}}

### Redactions
turt2live marked this conversation as resolved.
Show resolved Hide resolved

{{% added-in this=true %}} `m.room.join_rules` now keep `allow` in addition to other
{{% added-in this=true %}} `m.room.join_rules` events now keep `allow` in addition to other
keys in `content` when being redacted.

{{% boxes/warning %}}
Expand All @@ -60,8 +38,6 @@ v8 when creating new rooms.

The full redaction algorithm follows.

{{% rver-fragment name="v3-handling-redactions" %}}

Upon receipt of a redaction event, the server must strip off any keys
not in the following list:

Expand Down Expand Up @@ -91,6 +67,32 @@ of one of the following event types:
`kick`, `redact`, `state_default`, `users`, `users_default`.
- `m.room.history_visibility` allows key `history_visibility`.

## Server implementation components

{{% boxes/warning %}}
The information contained in this section is strictly for server
implementors. Applications which use the Client-Server API are generally
unaffected by the intricacies contained here. The section above
regarding client considerations is the resource that Client-Server API
use cases should reference.
{{% /boxes/warning %}}

Room version 8 adds a new join rule to allow members of a room to join another
room without invite. Otherwise, the room version inherits all properties of
[Room version 7](/rooms/v7).

### Authorization rules

{{% added-in this=true %}} For checks performed upon `m.room.member` events, new
points for handling `content.join_authorised_via_users_server` are added (Rule 4.2
and 4.3.5).

{{% rver-fragment name="v8-auth-rules" %}}

### Redactions

[See above](#redactions).

## Unchanged from v7

The following sections have not been modified since v7, but are included for
Expand All @@ -108,6 +110,10 @@ completeness.

{{% rver-fragment name="v4-event-format" %}}

### Handling redactions

{{% rver-fragment name="v3-handling-redactions" %}}

### Canonical JSON

{{% rver-fragment name="v6-canonical-json" %}}
Expand Down
36 changes: 22 additions & 14 deletions content/rooms/v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,6 @@ restricted rooms.
Clients which implement the redaction algorithm locally should refer to the
[redactions](#redactions) section below for a full overview.

## Server implementation components

{{% boxes/warning %}}
The information contained in this section is strictly for server
implementors. Applications which use the Client-Server API are generally
unaffected by the intricacies contained here. The section above
regarding client considerations is the resource that Client-Server API
use cases should reference.
{{% /boxes/warning %}}

Room version 8 added a new `restricted` join rule to allow members of a room
to join another room without invite. Room version 9 is based upon v8 with the
following considerations.

### Redactions

{{% added-in this=true %}} `m.room.member` now keep `join_authorised_via_users_server`
Expand Down Expand Up @@ -81,6 +67,24 @@ of one of the following event types:
`kick`, `redact`, `state_default`, `users`, `users_default`.
- `m.room.history_visibility` allows key `history_visibility`.

## Server implementation components

{{% boxes/warning %}}
The information contained in this section is strictly for server
implementors. Applications which use the Client-Server API are generally
unaffected by the intricacies contained here. The section above
regarding client considerations is the resource that Client-Server API
use cases should reference.
{{% /boxes/warning %}}

Room version 8 added a new `restricted` join rule to allow members of a room
to join another room without invite. Room version 9 is based upon v8 with the
following considerations.

### Redactions

[See above](#redactions).

## Unchanged from v8

The following sections have not been modified since v8, but are included for
Expand All @@ -102,6 +106,10 @@ completeness.

{{% rver-fragment name="v4-event-format" %}}

### Handling redactions

{{% rver-fragment name="v3-handling-redactions" %}}

### Canonical JSON

{{% rver-fragment name="v6-canonical-json" %}}
Expand Down
4 changes: 2 additions & 2 deletions content/server-server-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,8 @@ The joining server is expected to add or replace the `origin`,
`origin_server_ts`, and `event_id` on the templated event received by
the resident server. This event is then signed by the joining server.

To complete the join handshake, the joining server must now submit this
new event to a resident homeserver, by using the `PUT /send_join`
To complete the join handshake, the joining server submits this new event
to the resident server it used for `GET /make_join`, using the `PUT /send_join`
endpoint.

The resident homeserver then adds its signature to this event and
Expand Down
1 change: 1 addition & 0 deletions data/event-schemas/schema/m.room.join_rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ properties:
- restricted
type: string
allow:
x-addedInMatrixVersion: "1.2"
description: |-
turt2live marked this conversation as resolved.
Show resolved Hide resolved
For `restricted` rooms, the conditions the user will be tested against. The
user needs only to satisfy one of the conditions to join the `restricted`
Expand Down
6 changes: 4 additions & 2 deletions data/event-schemas/schema/m.room.member.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ properties:
Usually found on `join` events, this field is used to denote which homeserver (through representation of a user with sufficient power level)
authorised the user's join. More information about this field can be found in the [Restricted Rooms Specification](#restricted-rooms).

Client and server implementations should be aware of the [signing implications](/rooms/v8/#authorization-rules-for-events) of including this
field in further events: when copying the membership event's `content` (for profile updates and similar) it is encouraged to exclude this
Client and server implementations should be aware of the [signing implications](/rooms/v8/#authorization-rules) of including this
field in further events: in particular, the event must be signed by the server which
owns the user ID in the field. When copying the membership event's `content`
(for profile updates and similar) it is therefore encouraged to exclude this
field in the copy, as otherwise the event might fail event authorization.
reason:
x-addedInMatrixVersion: "1.1"
Expand Down
2 changes: 1 addition & 1 deletion static/diagrams/membership.drawio
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<mxfile host="app.diagrams.net" modified="2021-04-28T19:35:50.494Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" etag="-IOh23FjJiPnGlGWLseU" version="14.6.6" type="device"><diagram id="4a_pTli-mcEMNPq0ciXK" name="Page-1">3Vvdb6M4EP9rIt09NMIGA3ncZtvbh73TSn243X1ZOYmT0BIcOaZJ9q8/E0z4cggEgulVqoqHsbHHv/nwjDsyp5vDXwxv13/TBfFH0FgcRubnEYTAAa74E1GOMWViopiwYt5CMqWEF+83kURDUkNvQXY5Rk6pz71tnjinQUDmPEfDjNF9nm1J/fxXt3hFSoSXOfbL1H+9BV/HVBc6Kf0L8Vbr5MvAnsRvNjhhlivZrfGC7jMk82lkThmlPH7aHKbEj4SXyCXu93zh7XlijAS8TodvBvr96euj/xL83G+Dn2gaTvgDkMO8Yz+UKxYjvFIvkJPmx0QSZCEEI5uU8TVd0QD7Tyn1kdEwWJDoc4ZopTxfKd0KIhDEV8L5Ue4yDjkVpDXf+PJt/M3oQxfXKEk7GrI5qVqYxApmK8Ir+OB5JwSECd0Qzo6iHyM+5t57fh5YYml15pNdPzGGjxmGrZAf32VG/hYRBINUCziRmJBKYdqFrWvGLx7iGSStzFJS0gkOTaBhqaDhEyykogEb5ODx75nnH9FQY4hk8/NBDn1qHJNGIGTwPcMZtX9kX6b9Tq2kY4dIhKgmFC01FCUGjDEwHDMeqhk6S3Cy3DycoDUZ25kfx8qPGM9cDpLCrinqLVD4rG1Wot4CqIo/j/q0dzIdulzuCC/06EYzSorhBe8eL6tFHvT7teB52eITWvbCXaqM3zthnByqQXcRI9ApSBjJ9j51XcCQtHXGbSV8KgzlpNdYVHaFETEoG0VO6/nNm799cH8DO1JysRduOyW/P/4hVG3qDGuJGRK/YIxRxjOA29wC6NEt1ASMWQmYB2NsI6ulW+gBMSXAKEPMRvZySQP+jDeeH23OVIjbI5E5+Yfs72NMLUu7MXVVehcGujUvF5HVDMhAVu1kr34Uz2xnqWsrWautNks7rdrkQekLQoVDiqldX5R+KrY8hreMVhfOfG8+grYv5vI4E/KwV9FTxPOLhT7Z6XVp8Caf5ug66lg1VavtobsdKsq6Jca5EMH3sduXNq7HYKT2xqFr0QgaeigCnEEGr05W0426mq4tqVEXMBei1340vZzAUmevBuVGzWKuT7sbVUadGu1lO53RFnfCSWdG1rVdq52dPddnCgkjB+WHiFdVSv31arCNjx3F5RPW1ccjLXBraaLrIcuy6yGrs4yDsrCly82nHrtRhHdLbksHhK7mqFxogrsYLGTVg1XTWgUo1CqQWV2hs41Kfn21CqhMwA/Ae9+SNGp6tM3Fal+I/064N8cdK0lHZycRzN+iIU2BbVr5ohqYoIEAVXkuG0qlqGWV4eOitrpeJUy7A4ZffjAHFQzcEBf+L6B0NUpwEGoZJfRgpspJhbeAKozSoJMK5zBKW1IhuRXT8SWKvouC+m9YJEF6RpBPB06YMEknl1k8FP8R0JOmiN8N2cwI+7NC4qChxMsmpl1JqXCGVKXCoELY9r2EbSpzEdIAxMmIU+MBz4QwB5qQKJSVaiebu/E8r+Fmmyw0oAFJSPGsHV1JkKtxjuvCm3JuTQP0wt08YFUfPM+3EtT8Gi/Jle2S/pjrVug3O3ZmIY7ZvGNI171OejXcmvRy4ISTwoETXcmkwEr+ewBaNNNr+DF7+s8M5tN/</diagram></mxfile>
<mxfile host="Electron" modified="2022-01-10T02:42:21.552Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.1.2 Chrome/96.0.4664.55 Electron/16.0.5 Safari/537.36" etag="528W4E-DZvXgHQKcGR3G" version="16.1.2" type="device"><diagram id="4a_pTli-mcEMN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TQHTlL0O4+nVApa8ejWpNGqUa32jp1Ep6xwxXnbzmaF4J1j0F2Rd2zW7xVkBxXLByLGKQ6TTrJT+Bg3Y2nssDgYBPjFIVWjcKjFbnsuVFf4SBHCZLAD1/h4T0MXKdv0+aghc3jqWN4OgaTeD4M1KE9ITsLH4QJbalahgmyLYABBSL2a5wNB7iWyW2QxWqocaeulQwzLqj/JsrVZ/vEMNIK3UTyDNt6kuqe6BC6TuKwqOiPoe7OYkfW2yGOtv4yGqwDbM4umbvrAmAlTpBm4qR0odjyM+DGoVD7ZYaHf06Z9TGJMiAy144UeEkjpLcCyrI0sYIExVqw8vEZYEpUlXH15p1GjVB5Eeb/y1xdCnh+N/iiFYe86QD2eKCAtJ15RZ2RtH+Oop7DdE4QqR6uY4s7iuaPFGIUbh7Km0h5TVzIDE2HZfxjakRQseANKqxbVxB1fMmB/j/KlxVfo2mec5DvdiohGOkBClb+0MVARR5zmuC1oV51QJeukjPt2s33i+fr4g1x/xa7pqXBqfc7WFvtq2Mw9xSLxukG763ak63VoMsuEEi9KG03qnkgJq9fsANGtm3+un6tl/PRgP/wM=</diagram></mxfile>
Binary file modified static/diagrams/membership.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.