mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 09:19:23 +01:00
Use yaml.safe_load instead of yaml.load to prevent executing arbitrary code (#589)
This commit is contained in:
parent
9f6e4306cd
commit
7a1dcbd460
2
conf.py
2
conf.py
@ -118,7 +118,7 @@ def loadConf(filename, errors_fatal=True, logger=None):
|
|||||||
confname = os.path.splitext(os.path.basename(filename))[0]
|
confname = os.path.splitext(os.path.basename(filename))[0]
|
||||||
try:
|
try:
|
||||||
with open(filename, 'r') as f:
|
with open(filename, 'r') as f:
|
||||||
conf = yaml.load(f)
|
conf = yaml.safe_load(f)
|
||||||
conf = validateConf(conf, logger=logger)
|
conf = validateConf(conf, logger=logger)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('ERROR: Failed to load config from %r: %s: %s' % (filename, type(e).__name__, e), file=sys.stderr)
|
print('ERROR: Failed to load config from %r: %s: %s' % (filename, type(e).__name__, e), file=sys.stderr)
|
||||||
|
Loading…
Reference in New Issue
Block a user