-
Notifications
You must be signed in to change notification settings - Fork 415
Room versions 8 and 9: Restricted rooms #3387
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
Merged
Merged
Changes from 9 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 7a5e820
Changelogs
turt2live 3769724
Capitalization
turt2live f7f2ea8
Remove verbiage for spaces because they don't exist
turt2live 2ccae80
Iterations on text
turt2live e3b7735
Merge remote-tracking branch 'origin/travis/spec/v8-v9' into travis/s…
turt2live db2a738
Another clarification
turt2live c613d2e
Make error code descriptions consistent
turt2live d521f25
Merge remote-tracking branch 'origin/main' into travis/spec/v8-v9
turt2live b31298d
Apply suggestions from code review
turt2live 9c18649
Merge branch 'main' into travis/spec/v8-v9
turt2live b04da31
Incorporate from merge
turt2live 17954df
Misc language update per review
turt2live 75fc992
Update accuracy before splitting auth rules
turt2live 44fc526
fix wtf moment
turt2live 3447b12
Fix up v8 and v9 to match "fully specify room versions"
turt2live a8fa47f
Scope auth events selection to room version
turt2live 157f750
Apply consistency
turt2live 42195ca
Add changelogs
turt2live 56bf4a4
Review part 1
turt2live 245cc17
Apply suggestions from code review
turt2live fd82238
Split out redaction sections
turt2live cc65d8a
Clarify general case of join conditions
turt2live e58bc1b
Update diagram
turt2live File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add support for `restricted` rooms as per [MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083), [MSC3289](https://github.com/matrix-org/matrix-doc/pull/3289), and [MSC3375](https://github.com/matrix-org/matrix-doc/pull/3375). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add support for `restricted` rooms as per [MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083), [MSC3289](https://github.com/matrix-org/matrix-doc/pull/3289), and [MSC3375](https://github.com/matrix-org/matrix-doc/pull/3375). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| --- | ||
| title: Room Version 8 | ||
| type: docs | ||
| weight: 60 | ||
| --- | ||
|
|
||
| This room version builds on [version 7](/rooms/v7) to introduce a new | ||
| join rule that allows members to join the room based on membership in | ||
| another room. | ||
|
|
||
| {{% boxes/warning %}} | ||
| This room version is known to have issues relating to redactions of member | ||
| join events. [Room version 9](/rooms/v9) should be preferred over v8 when | ||
| creating rooms. | ||
| {{% /boxes/warning %}} | ||
|
|
||
| ## Client considerations | ||
|
|
||
| Clients are encouraged to expose the option for the join rule in their | ||
| user interface for supported room versions. | ||
|
|
||
| The new join rule, `restricted`, is described in the Client-Server API | ||
| under the [`m.room.join_rules`](/client-server-api/#mroomjoin_rules) section. | ||
|
|
||
| ## 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 for events | ||
|
|
||
| `m.room.member` events for `membership` of `join` are now validated as such: | ||
turt2live marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 1. If the only previous event is an `m.room.create` and the `state_key` is the | ||
| creator, allow. | ||
| 2. If the `sender` does not match `state_key`, reject. | ||
| 3. If the `sender` is banned, reject. | ||
| 4. If the `join_rule` is `invite` then allow if membership state is `invite` or | ||
| `knock`. | ||
turt2live marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 5. **[New in this room version]** If the `join_rule` is `restricted`: | ||
| 1. If membership state is `join`, allow. | ||
turt2live marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 2. If `content.join_authorised_via_users_server` is not a user with | ||
| sufficient permission to invite other users, reject. | ||
| 3. If the event is not validly signed by the server denoted by the user ID in | ||
turt2live marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `content.join_authorised_via_users_server`, reject. | ||
| 4. Otherwise, allow. | ||
| 6. If the `join_rule` is `public`, allow. | ||
| 7. Otherwise, reject. | ||
|
|
||
| The remaining rules are the same as in [room version 7](/rooms/v7#server-implementation-components). | ||
turt2live marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Redactions | ||
turt2live marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Events of type `m.room.join_rules` now keep the following `content` properties | ||
| when the event is redacted: | ||
| * `join_rule` | ||
| * **[New in this room version]** `allow` | ||
|
|
||
| {{% boxes/warning %}} | ||
| [Room version 9](/rooms/v9) adds additional cases of protected properties for behaviour | ||
| related to restricted rooms (the functionality introduced in v8). v9 is preferred over | ||
| v8 when creating new rooms. | ||
| {{% /boxes/warning %}} | ||
|
|
||
| The remaining rules are the same as in [room version 6](/rooms/v6#redactions) (the | ||
| last room version to modify the redaction rules). | ||
turt2live marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| title: Room Version 9 | ||
| type: docs | ||
| weight: 60 | ||
| --- | ||
|
|
||
| This room version builds on [version 8](/rooms/v8) to add additional redaction | ||
| rules that were unintentionally missed when incorporating v8. | ||
|
|
||
| ## Client considerations | ||
|
|
||
| See [room version 8](/rooms/v8) for specific details regarding the addition of | ||
| restricted rooms. | ||
|
|
||
| Clients which implement a local redaction algorithm are encouraged to read on. | ||
clokep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## 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 | ||
|
|
||
| Events of type `m.room.member` now keep the following `content` properties | ||
| when the event is redacted: | ||
| * `membership` | ||
| * **[New in this room version]** `join_authorised_via_users_server` | ||
|
|
||
| The remaining rules are the same as in [room version 8](/rooms/v8#redactions). | ||
|
|
||
| {{% boxes/rationale %}} | ||
| Without the `join_authorised_via_users_server` property redacted join events | ||
turt2live marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| can become invalid when verifying the auth chain of a given event, thus creating | ||
| a split-brain scenario where the user is able to speak from one server's | ||
| perspective but most others will continually reject their events. | ||
|
|
||
| This can theoretically be worked around with a rejoin to the room, being careful | ||
| not to use the faulty events as `prev_events`, though instead it is encouraged | ||
| to use v9 rooms over v8 rooms to outright avoid the situation. | ||
|
|
||
| [Issue #3373](https://github.com/matrix-org/matrix-doc/issues/3373) has further | ||
| information. | ||
| {{% /boxes/rationale %}} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
data/api/server-server/examples/pdu_v4_join_membership.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "$ref": "unsigned_pdu_base.json", | ||
| "hashes": { | ||
| "sha256": "thishashcoversallfieldsincasethisisredacted" | ||
| }, | ||
| "signatures": { | ||
| "example.com": { | ||
| "ed25519:key_version:": "these86bytesofbase64signaturecoveressentialfieldsincludinghashessocancheckredactedpdus" | ||
turt2live marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| "resident.example.com": { | ||
| "ed25519:key_version:": "a different signature" | ||
turt2live marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| }, | ||
| "auth_events": [ | ||
| "$urlsafe_base64_encoded_eventid", | ||
| "$a-different-event-id" | ||
| ], | ||
| "prev_events": [ | ||
| "$urlsafe_base64_encoded_eventid", | ||
| "$a-different-event-id" | ||
| ], | ||
| "type": "m.room.member", | ||
| "state_key": "@alice:example.com", | ||
| "content": { | ||
| "membership": "join", | ||
| "join_authorised_via_users_server": "@arbitrary:resident.example.com" | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.