3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

Use yaml.safe_load instead of yaml.load to prevent executing arbitrary code (#589)

This commit is contained in:
Jordy Zomer 2018-03-29 21:43:13 +02:00 committed by James Lu
parent 335fb352ec
commit be8e4be49d

View File

@ -117,7 +117,7 @@ def load_conf(filename, errors_fatal=True, logger=None):
confname = os.path.splitext(os.path.basename(filename))[0]
try:
with open(filename, 'r') as f:
conf = yaml.load(f)
conf = yaml.safe_load(f)
conf = _validate_conf(conf, logger=logger)
except Exception as e:
e = 'Failed to load config from %r: %s: %s' % (filename, type(e).__name__, e)