summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2023-01-18 09:27:57 -0500
committerGitHub <noreply@github.com>2023-01-18 09:27:57 -0500
commit4d6b1d3c47387466d34abb98613ca0d240057e24 (patch)
tree08df969de7124271ab9cc98a6aee9da884f9d907 /synapse
parentBump packaging from 22.0 to 23.0 (#14847) (diff)
downloadsynapse-4d6b1d3c47387466d34abb98613ca0d240057e24.tar.xz
Properly check for frozendicts in event auth code. (#14864)
Check for for an instance of a mapping instead of a dict.

This only affects room version 10 when frozen events are enabled.
Diffstat (limited to '')
-rw-r--r--synapse/event_auth.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/event_auth.py b/synapse/event_auth.py
index d437b7e5d1..c4a7b16413 100644
--- a/synapse/event_auth.py
+++ b/synapse/event_auth.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import collections.abc
 import logging
 import typing
 from typing import (
@@ -877,7 +878,7 @@ def _check_power_levels(
                 if not isinstance(v, int):
                     raise SynapseError(400, f"{v!r} must be an integer.")
             if k in {"events", "notifications", "users"}:
-                if not isinstance(v, dict) or not all(
+                if not isinstance(v, collections.abc.Mapping) or not all(
                     isinstance(v, int) for v in v.values()
                 ):
                     raise SynapseError(