mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:56:06 -04:00
Strictly enforce canonicaljson requirements in a new room version (#7381)
This commit is contained in:
parent
ec0b72bc4e
commit
56b66db78a
7 changed files with 137 additions and 5 deletions
|
@ -59,7 +59,11 @@ class RoomVersion(object):
|
|||
|
||||
# bool: before MSC2261/MSC2432, m.room.aliases had special auth rules and redaction rules
|
||||
special_case_aliases_auth = attr.ib(type=bool)
|
||||
|
||||
# Strictly enforce canonicaljson, do not allow:
|
||||
# * Integers outside the range of [-2 ^ 53 + 1, 2 ^ 53 - 1]
|
||||
# * Floats
|
||||
# * NaN, Infinity, -Infinity
|
||||
strict_canonicaljson = attr.ib(type=bool)
|
||||
# bool: MSC2209: Check 'notifications' key while verifying
|
||||
# m.room.power_levels auth rules.
|
||||
limit_notifications_power_levels = attr.ib(type=bool)
|
||||
|
@ -73,6 +77,7 @@ class RoomVersions(object):
|
|||
StateResolutionVersions.V1,
|
||||
enforce_key_validity=False,
|
||||
special_case_aliases_auth=True,
|
||||
strict_canonicaljson=False,
|
||||
limit_notifications_power_levels=False,
|
||||
)
|
||||
V2 = RoomVersion(
|
||||
|
@ -82,6 +87,7 @@ class RoomVersions(object):
|
|||
StateResolutionVersions.V2,
|
||||
enforce_key_validity=False,
|
||||
special_case_aliases_auth=True,
|
||||
strict_canonicaljson=False,
|
||||
limit_notifications_power_levels=False,
|
||||
)
|
||||
V3 = RoomVersion(
|
||||
|
@ -91,6 +97,7 @@ class RoomVersions(object):
|
|||
StateResolutionVersions.V2,
|
||||
enforce_key_validity=False,
|
||||
special_case_aliases_auth=True,
|
||||
strict_canonicaljson=False,
|
||||
limit_notifications_power_levels=False,
|
||||
)
|
||||
V4 = RoomVersion(
|
||||
|
@ -100,6 +107,7 @@ class RoomVersions(object):
|
|||
StateResolutionVersions.V2,
|
||||
enforce_key_validity=False,
|
||||
special_case_aliases_auth=True,
|
||||
strict_canonicaljson=False,
|
||||
limit_notifications_power_levels=False,
|
||||
)
|
||||
V5 = RoomVersion(
|
||||
|
@ -109,6 +117,7 @@ class RoomVersions(object):
|
|||
StateResolutionVersions.V2,
|
||||
enforce_key_validity=True,
|
||||
special_case_aliases_auth=True,
|
||||
strict_canonicaljson=False,
|
||||
limit_notifications_power_levels=False,
|
||||
)
|
||||
MSC2432_DEV = RoomVersion(
|
||||
|
@ -118,6 +127,17 @@ class RoomVersions(object):
|
|||
StateResolutionVersions.V2,
|
||||
enforce_key_validity=True,
|
||||
special_case_aliases_auth=False,
|
||||
strict_canonicaljson=False,
|
||||
limit_notifications_power_levels=False,
|
||||
)
|
||||
STRICT_CANONICALJSON = RoomVersion(
|
||||
"org.matrix.strict_canonicaljson",
|
||||
RoomDisposition.UNSTABLE,
|
||||
EventFormatVersions.V3,
|
||||
StateResolutionVersions.V2,
|
||||
enforce_key_validity=True,
|
||||
special_case_aliases_auth=True,
|
||||
strict_canonicaljson=True,
|
||||
limit_notifications_power_levels=False,
|
||||
)
|
||||
MSC2209_DEV = RoomVersion(
|
||||
|
@ -127,6 +147,7 @@ class RoomVersions(object):
|
|||
StateResolutionVersions.V2,
|
||||
enforce_key_validity=True,
|
||||
special_case_aliases_auth=True,
|
||||
strict_canonicaljson=False,
|
||||
limit_notifications_power_levels=True,
|
||||
)
|
||||
|
||||
|
@ -140,6 +161,7 @@ KNOWN_ROOM_VERSIONS = {
|
|||
RoomVersions.V4,
|
||||
RoomVersions.V5,
|
||||
RoomVersions.MSC2432_DEV,
|
||||
RoomVersions.STRICT_CANONICALJSON,
|
||||
RoomVersions.MSC2209_DEV,
|
||||
)
|
||||
} # type: Dict[str, RoomVersion]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue