2 files changed, 7 insertions, 1 deletions
diff --git a/changelog.d/7822.bugfix b/changelog.d/7822.bugfix
new file mode 100644
index 0000000000..faf249a678
--- /dev/null
+++ b/changelog.d/7822.bugfix
@@ -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.
diff --git a/synapse/config/room.py b/synapse/config/room.py
index 6aa4de0672..52cf0b62fc 100644
--- a/synapse/config/room.py
+++ b/synapse/config/room.py
@@ -50,7 +50,12 @@ class RoomConfig(Config):
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.
self.encryption_enabled_by_default_for_room_presets = []
else:
raise ConfigError(
|