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

Specify room version 10: knock_restricted and int power levels #1099

Merged
merged 25 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f443b3d
Clarification on historical power level handling
neilalexander May 24, 2022
6b175d6
Revert "Clarification on historical power level handling"
neilalexander May 24, 2022
7fd54c4
Clean up
neilalexander May 24, 2022
666baf6
Let us try this again not using VS Code
neilalexander May 24, 2022
a5a4c1f
Markdown is full of mysteries
neilalexander May 24, 2022
503a815
Merge remote-tracking branch 'neilalexander/neilalexander/powerlevels…
turt2live May 30, 2022
3dd5bee
Move stringy power levels to room versions
turt2live May 30, 2022
b2fa4e5
Describe range
turt2live May 30, 2022
be12f1e
Fix minor issues with previous room version stuff
turt2live May 30, 2022
16e7383
Copy/paste v9 into v10
turt2live May 30, 2022
3d50019
Describe deprecated formatting
turt2live May 30, 2022
1f3dc21
Paste unmodified auth rules from v8 into v10
turt2live May 30, 2022
0174618
Move 9.1 to 9.3, add 9.1 and 9.2 for integer enforcement
turt2live May 30, 2022
0eec78d
Add knock_restricted to v10 auth
turt2live May 30, 2022
41ed640
Misc cleanup and clarification for fragments
turt2live May 30, 2022
5e3175a
Describe `knock_restricted` client changes
turt2live May 30, 2022
56157dc
Changelogs
turt2live May 30, 2022
a8cd1ae
spelling
turt2live May 30, 2022
290fa16
Merge branch 'main' into travis/spec/v10
turt2live May 30, 2022
1653b43
Apply suggestions from code review
turt2live Jun 7, 2022
67d2847
Apply code review suggestions manually
turt2live Jun 7, 2022
47169fd
Fix v9 redactions
turt2live Jun 7, 2022
1e2f4f6
Fix auth rules clarity issues
turt2live Jun 7, 2022
2b7483a
Apply suggestions from code review
turt2live Jun 8, 2022
05ad39d
Remove false integer requirements
turt2live Jun 8, 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
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Clarifies the historical handling of non-integer power levels.
Clarify the historical handling of non-integer power levels.
46 changes: 35 additions & 11 deletions content/rooms/fragments/v1-stringy-power-levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,47 @@
toc_hide: true
---

##### Power levels accepted as strings
##### `m.room.power_levels` events accept values as strings

In order to maintain backwards compatibility with early implementations,
power levels can optionally be represented in string format instead of
integer format. A homeserver must be prepared to deal with this by parsing
the power level from a string. In these cases, the following formatting of the
power level string is allowed:
each of the integer-valued properties within
[`m.room.power_levels`](/client-server-api#mroompower_levels) events can
be encoded as strings instead of integers. This includes the nested values
within the `events`, `notifications` and `users` properties.
For example, the following is a valid `m.room.power_levels` event in this room version:

* a single Base10 integer, no float values or decimal points, optionally with
```json
{
"content": {
"ban": "50",
"events": {
"m.room.power_levels": "100"
},
"events_default": "0",
"state_default": "50",
"users": {
"@example:localhost": "100"
},
"users_default": "0"
},
"origin_server_ts": 1432735824653,
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
"sender": "@example:example.org",
"state_key": "",
"type": "m.room.power_levels"
}
```

When the value is representative of an integer, they must be the following format:

* a single base 10 integer, no float values or decimal points, optionally with
any number of leading zeroes (`"100"`, `"000100"`);
* optionally with any number of leading or trailing whitespace characters (`" 100 "`,
`" 00100 "`);
* optionally prefixed with a single `-` or `+` character before the integer
but after leading whitespace padding (`" +100 "`, `" -100 "`, `"+100"`,
* optionally prefixed with a single `-` or `+` character before the integer (`"+100"`,
`"-100"`).
* optionally with any number of leading or trailing whitespace characters (`" 100 "`,
`" 00100 "`, `" +100 "`, `" -100 "`);

{{% boxes/note %}}
The integer represented by the string must still be within the `[-2^53, 2^53)`
The integer represented by the string must still be within the `[-(2**53)+1, (2**53)-1]`
range accepted by normal, non-string, power level values.
{{% /boxes/note %}}
5 changes: 3 additions & 2 deletions content/rooms/fragments/v9-redactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
toc_hide: true
---

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

{{% boxes/rationale %}}
Without the `join_authorised_via_users_server` property, redacted join events
can become invalid when verifying the auth chain of a given event, thus creating
Expand All @@ -18,8 +21,6 @@ information.

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
2 changes: 1 addition & 1 deletion content/rooms/v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Events in version 1 rooms have the following structure:

{{% definition path="api/server-server/definitions/pdu" %}}

#### Deprecated formatting
#### Deprecated event content schemas

{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

Expand Down
18 changes: 9 additions & 9 deletions content/rooms/v10.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ use cases should reference.
{{% /boxes/warning %}}

[Room version 7](/rooms/v7) added "knocking" and [room version 8](/rooms/v8)
added "join restrictions" (refined by [room version 9](/rooms/v9)) - both allow
prospective members an avenue to join, however both could not be used at the
same time due to how the join rules work. This room version adds a new
added "join restrictions" (refined by [room version 9](/rooms/v9)) both allow
prospective members an avenue to join, however it was not possible to use
the two mechanisms together. This room version adds a new
`knock_restricted` join rule as a mix of the two behaviours, allowing a user to
join the room if they meet either the `restricted` join rule criteria or the
`knock` join rule criteria - whichever function they're attempting to use.
`knock` join rule criteria.

This room version additionally requires that values in the power levels event
be integers and not string representations, unlike other room versions.
Expand All @@ -58,12 +58,12 @@ Room version 10 is based upon room version 9 with the following considerations.
The event format is unchanged by this room version. See [below](#event-format-1)
for details on the current event format.

#### Deprecated formatting
#### Deprecated event content schemas

While this room version does not change the event format specifically, some
deprecated behaviours are strictly no longer supported.

##### Power levels must be integers
##### Values in `m.room.power_levels` events must be integers

In other room versions, such as [v9](/rooms/v9/#power-levels-accepted-as-strings),
power levels could be represented as strings for backwards compatibility.
Expand Down Expand Up @@ -205,9 +205,9 @@ The rules are as follows:
`ban`, `redact`, `kick`, or `invite` in `content` are present and
not an integer, reject.
2. {{< added-in this="true" >}}
If any of the keys `users`, `events`, or `notifications` in `content`
are present and not a dictionary with string keys and values that
are integers, reject.
If any of the keys `events` or `notifications` in `content`
are present and not a dictionary with values that are integers,
reject.
3. If `users` key in `content` is not a dictionary with keys that
are valid user IDs with values that are integers, reject.
2. If there is no previous `m.room.power_levels` event in the room,
Expand Down
2 changes: 1 addition & 1 deletion content/rooms/v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Events in rooms of this version have the following structure:

{{% definition path="api/server-server/definitions/pdu" %}}

#### Deprecated formatting
#### Deprecated event content schemas

{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

Expand Down
2 changes: 1 addition & 1 deletion content/rooms/v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The complete structure of a event in a v3 room is shown below.

{{% definition path="api/server-server/definitions/pdu_v3" %}}

#### Deprecated formatting
#### Deprecated event content schemas

{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

Expand Down
2 changes: 1 addition & 1 deletion content/rooms/v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ the changes in this room version.

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

#### Deprecated formatting
#### Deprecated event content schemas

{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

Expand Down
2 changes: 1 addition & 1 deletion content/rooms/v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ completeness.

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

#### Deprecated formatting
#### Deprecated event content schemas

{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

Expand Down
2 changes: 1 addition & 1 deletion content/rooms/v6.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ completeness.

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

#### Deprecated formatting
#### Deprecated event content schemas

{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

Expand Down
2 changes: 1 addition & 1 deletion content/rooms/v7.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ completeness.

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

#### Deprecated formatting
#### Deprecated event content schemas

{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

Expand Down
2 changes: 1 addition & 1 deletion content/rooms/v8.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ completeness.

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

#### Deprecated formatting
#### Deprecated event content schemas

{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

Expand Down
7 changes: 2 additions & 5 deletions content/rooms/v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ Clients which implement the redaction algorithm locally should refer to the

### Redactions

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

{{% rver-fragment name="v9-redactions" %}}
{{% rver-fragment name="v9-redactions" withVersioning="true" %}}

## Server implementation components

Expand Down Expand Up @@ -57,7 +54,7 @@ completeness.

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

#### Deprecated formatting
#### Deprecated event content schemas

{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

Expand Down