matrixsynapse: Use yaml.safe_load

yaml.load() now requires a Loader= argument. yaml.safe_load() passes
SafeLoader to yaml.load().

Fixes: #2315.

Tests:

- Matrix functional tests passed in testing container.

- Matrix functional tests passed in stable container.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2023-02-05 08:54:53 -05:00 committed by Sunil Mohan Adapa
parent b49afbc4ff
commit 982fec5a60
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -49,7 +49,7 @@ def post_install():
# start with listener config from original homeserver.yaml
with open(ORIG_CONF_PATH, encoding='utf-8') as orig_conf_file:
orig_config = yaml.load(orig_conf_file)
orig_config = yaml.safe_load(orig_conf_file)
listeners = orig_config['listeners']
for listener in listeners:
@ -77,11 +77,11 @@ def public_registration(command: str) -> Optional[bool]:
try:
with open(REGISTRATION_CONF_PATH, encoding='utf-8') as reg_conf_file:
config = yaml.load(reg_conf_file)
config = yaml.safe_load(reg_conf_file)
except FileNotFoundError:
# Check if its set in original conffile.
with open(ORIG_CONF_PATH, encoding='utf-8') as orig_conf_file:
orig_config = yaml.load(orig_conf_file)
orig_config = yaml.safe_load(orig_conf_file)
config = {
'enable_registration':
orig_config.get('enable_registration', False)