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

ERROR: Invalid value for encryption_enabled_by_default_for_room_type #7821

Closed
rodolpheh opened this issue Jul 11, 2020 · 2 comments · Fixed by #7822
Closed

ERROR: Invalid value for encryption_enabled_by_default_for_room_type #7821

rodolpheh opened this issue Jul 11, 2020 · 2 comments · Fixed by #7822
Assignees

Comments

@rodolpheh
Copy link

Description

When updating from 1.16.0 to 1.16.1, I stumbled upon an issue where my server wouldn't restart. The logs displays the following error :

ERROR: Invalid value for encryption_enabled_by_default_for_room_type

I previously set up encryption_enabled_by_default to off in my homeserver.yaml. Since it should be off by default, I just commented the line and the server started without any issue.

Steps to reproduce

  • set the parameter encryption_enabled_by_default_for_room_type to off in your homeserver.yaml
  • recreate the container
  • watch the logs

Version information

  • Homeserver:

If not matrix.org: lunai.re

  • Version: 1.16.1

  • Install method: docker

  • Platform: docker container in an Arch Linux set up
@babolivier
Copy link
Contributor

babolivier commented Jul 11, 2020

Hey @rodolpheh, and thanks for your report!

It looks like we weren't aware, when implementing this feature, that PyYAML (the parser we use for the configuration file) translates the string "off" into the boolean value False if it's unquoted. This seems to be a liberal interpretation of the YAML spec.

The right fix for Synapse here is to also check for whether the parsed value for encryption_enabled_by_default_for_room_type is False.

babolivier added a commit that referenced this issue Jul 11, 2020
Fixes #7821, introduced in #7639

Turns out PyYAML translates `off` into a `False` boolean if it's
unquoted (see https://stackoverflow.com/questions/36463531/pyyaml-automatically-converting-certain-keys-to-boolean-values),
which seems to be a liberal interpretation of this bit of the YAML spec: https://yaml.org/spec/1.1/current.html#id864510

An alternative fix would be to implement the solution mentioned in the
SO post linked above, but I'm aware it might break existing setups
(which might use these values in the configuration file) so it's
probably better just to add an extra check for this one. We should be
aware that this is a thing for the next times we do that though.

I didn't find any other occurrence of this bug elsewhere in the
codebase.
@babolivier babolivier self-assigned this Jul 11, 2020
@babolivier
Copy link
Contributor

Will be fixed in #7822

babolivier added a commit that referenced this issue Jul 13, 2020
…7822)

Fixes #7821, introduced in #7639

Turns out PyYAML translates `off` into a `False` boolean if it's
unquoted (see https://stackoverflow.com/questions/36463531/pyyaml-automatically-converting-certain-keys-to-boolean-values),
which seems to be a liberal interpretation of this bit of the YAML spec: https://yaml.org/spec/1.1/current.html#id864510

An alternative fix would be to implement the solution mentioned in the
SO post linked above, but I'm aware it might break existing setups
(which might use these values in the configuration file) so it's
probably better just to add an extra check for this one. We should be
aware that this is a thing for the next times we do that though.

I didn't find any other occurrence of this bug elsewhere in the
codebase.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants