3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-28 13:42:37 +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 9f6e4306cd
commit 7a1dcbd460

View File

@ -118,7 +118,7 @@ def loadConf(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 = validateConf(conf, logger=logger)
except Exception as e:
print('ERROR: Failed to load config from %r: %s: %s' % (filename, type(e).__name__, e), file=sys.stderr)