Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 4d6b1d3

Browse files
authored
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.
1 parent e1b2c70 commit 4d6b1d3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

changelog.d/14864.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug introduced in Synapse 1.64.0 when using room version 10 with frozen events enabled.

synapse/event_auth.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
import collections.abc
1617
import logging
1718
import typing
1819
from typing import (
@@ -877,7 +878,7 @@ def _check_power_levels(
877878
if not isinstance(v, int):
878879
raise SynapseError(400, f"{v!r} must be an integer.")
879880
if k in {"events", "notifications", "users"}:
880-
if not isinstance(v, dict) or not all(
881+
if not isinstance(v, collections.abc.Mapping) or not all(
881882
isinstance(v, int) for v in v.values()
882883
):
883884
raise SynapseError(

0 commit comments

Comments
 (0)