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

Fix handling of "off" in encryption_enabled_by_default_for_room_type #7822

Merged
merged 2 commits into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7822.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug causing Synapse to misinterpret the value `off` for `encryption_enabled_by_default_for_room_type` in its configuration file(s) if that value isn't surrounded by quotes. This bug was introduced in v1.16.0.
7 changes: 6 additions & 1 deletion synapse/config/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ def read_config(self, config, **kwargs):
RoomCreationPreset.PRIVATE_CHAT,
RoomCreationPreset.TRUSTED_PRIVATE_CHAT,
]
elif encryption_for_room_type == RoomDefaultEncryptionTypes.OFF:
elif (
encryption_for_room_type == RoomDefaultEncryptionTypes.OFF
or encryption_for_room_type is False
):
# PyYAML translates "off" into False if it's unquoted, so we also need to
# check for encryption_for_room_type being False.
Comment on lines +57 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be extra pedantic, it's part of YAML 1.1 and not present in YAML 1.2.2, or at least not mentioned in the spec: https://yaml.org/spec/1.2.2/#1032-tag-resolution

PyYAML implements YAML 1.1 I believe.

self.encryption_enabled_by_default_for_room_presets = []
else:
raise ConfigError(
Expand Down