Skip to content

Commit

Permalink
Fix code execution vulnerability by switching to yaml.safe_load
Browse files Browse the repository at this point in the history
  • Loading branch information
ypid committed Feb 21, 2017
1 parent 4d62118 commit 987f7e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ansiblecmdb/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def _parse_hostvar_dir(self, inventory_path):

try:
f = codecs.open(f_path, 'r', encoding='utf8')
invars = yaml.load(f)
invars = yaml.safe_load(f)
f.close()
self.update_host(fname, {'hostvars': invars})
except Exception as err:
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblecmdb/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def _parse_line_vars(self, line):
k, v = line.strip().split('=', 1)
if v.startswith('['):
try:
list_res = yaml.load(v)
list_res = yaml.safe_load(v)
if isinstance(list_res[0], dict):
key_values = list_res[0]
return key_values
Expand Down

0 comments on commit 987f7e2

Please sign in to comment.