diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-05-14 13:24:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-14 13:24:01 -0400 |
commit | 56b66db78a3a6a22f65b219f4dc12899111f742b (patch) | |
tree | 6af77f84427554db2efe6fcd8bfe087911e357b9 /synapse/federation | |
parent | Merge branch 'master' into develop (diff) | |
download | synapse-56b66db78a3a6a22f65b219f4dc12899111f742b.tar.xz |
Strictly enforce canonicaljson requirements in a new room version (#7381)
Diffstat (limited to 'synapse/federation')
-rw-r--r-- | synapse/federation/federation_base.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/federation/federation_base.py b/synapse/federation/federation_base.py index 4b115aac04..c0012c6872 100644 --- a/synapse/federation/federation_base.py +++ b/synapse/federation/federation_base.py @@ -29,7 +29,7 @@ from synapse.api.room_versions import EventFormatVersions, RoomVersion from synapse.crypto.event_signing import check_event_content_hash from synapse.crypto.keyring import Keyring from synapse.events import EventBase, make_event_from_dict -from synapse.events.utils import prune_event +from synapse.events.utils import prune_event, validate_canonicaljson from synapse.http.servlet import assert_params_in_dict from synapse.logging.context import ( PreserveLoggingContext, @@ -302,6 +302,10 @@ def event_from_pdu_json( elif depth > MAX_DEPTH: raise SynapseError(400, "Depth too large", Codes.BAD_JSON) + # Validate that the JSON conforms to the specification. + if room_version.strict_canonicaljson: + validate_canonicaljson(pdu_json) + event = make_event_from_dict(pdu_json, room_version) event.internal_metadata.outlier = outlier |