Replace yaml.load() with yaml.safe_load()

Yaml.load() return Python object may be dangerous if
you receive a YAML document from an untrusted source
such as the Internet. The function yaml.safe_load()
limits this ability to simple Python objects like
integers or lists.

Reference:
https://security.openstack.org/guidelines/dg_avoid-dangerous-input-parsing-libraries.html

Change-Id: Ib2bfd11354c6b35c90938c1075729dc7028236a3
This commit is contained in:
chenaidong1 2017-03-10 16:18:30 +08:00
parent 5705749060
commit bb79184e69

View File

@ -79,7 +79,7 @@ def main(argv=sys.argv):
# convert config to dict
if not isinstance(config, dict):
config = ast.literal_eval(json.dumps(yaml.load(config)))
config = ast.literal_eval(json.dumps(yaml.safe_load(config)))
os.chdir(proj)