From 55737f797ad09c046ef01dae078209d2fe2b5a1f Mon Sep 17 00:00:00 2001 From: Fabio Caccamo Date: Mon, 18 Nov 2019 11:16:53 +0100 Subject: [PATCH] Replace unsafe yaml.load with yaml.safe_load. --- benedict/utils/io_util.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/benedict/utils/io_util.py b/benedict/utils/io_util.py index 76d7653..cdd1b0d 100644 --- a/benedict/utils/io_util.py +++ b/benedict/utils/io_util.py @@ -109,8 +109,7 @@ def decode_toml(s, **kwargs): def decode_yaml(s, **kwargs): - kwargs.setdefault('Loader', yaml.Loader) - data = yaml.load(s, **kwargs) + data = yaml.safe_load(s, **kwargs) return data @@ -186,7 +185,7 @@ def encode_xml(d, **kwargs): def encode_yaml(d, **kwargs): - data = yaml.dump(d, **kwargs) + data = yaml.dump(dict(d), **kwargs) return data