mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-02 15:59:26 +01:00
Use yaml.safe_load instead of yaml.load to prevent executing arbitrary code (#589)
This commit is contained in:
parent
335fb352ec
commit
be8e4be49d
2
conf.py
2
conf.py
@ -117,7 +117,7 @@ def load_conf(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 = _validate_conf(conf, logger=logger)
|
conf = _validate_conf(conf, logger=logger)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
e = 'Failed to load config from %r: %s: %s' % (filename, type(e).__name__, e)
|
e = 'Failed to load config from %r: %s: %s' % (filename, type(e).__name__, e)
|
||||||
|
Loading…
Reference in New Issue
Block a user