Skip to content
Snippets Groups Projects
Unverified Commit 4d6b1d3c authored by Patrick Cloke's avatar Patrick Cloke Committed by GitHub
Browse files

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.
parent e1b2c709
No related branches found
No related tags found
No related merge requests found
Fix a bug introduced in Synapse 1.64.0 when using room version 10 with frozen events enabled.
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import collections.abc
import logging import logging
import typing import typing
from typing import ( from typing import (
...@@ -877,7 +878,7 @@ def _check_power_levels( ...@@ -877,7 +878,7 @@ def _check_power_levels(
if not isinstance(v, int): if not isinstance(v, int):
raise SynapseError(400, f"{v!r} must be an integer.") raise SynapseError(400, f"{v!r} must be an integer.")
if k in {"events", "notifications", "users"}: 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() isinstance(v, int) for v in v.values()
): ):
raise SynapseError( raise SynapseError(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment