Skip to content

Commit 38400e9

Browse files
committed
Update pyyaml version
GitHub warns about pyyaml < 4.2b1, because of CVE-2017-18342: yaml.load() could cause arbitrary code execution. I think it is not very important in the case of test-run, because a test code is controlled by a user, but anyway it is good to be up to date. Eliminated new pyyaml warnings about using of unsafe yaml.load(): replaced it with yaml.safe_load(). We don't construct Python classes directly according to yaml tags, so safe_load() fit our needs.
1 parent fe9ca2e commit 38400e9

6 files changed

+9
-9
lines changed

lib/admin_connection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def cmd(self, socket, cmd, silent):
6969
break
7070

7171
try:
72-
yaml.load(res)
72+
yaml.safe_load(res)
7373
finally:
7474
if not silent:
7575
sys.stdout.write(res.replace("\r\n", "\n"))

lib/preprocessor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def lua_eval(self, name, expr, silent=True):
341341
result = self.servers[name].admin(
342342
'%s%s' % (expr, self.delimiter), silent=silent
343343
)
344-
result = yaml.load(result)
344+
result = yaml.safe_load(result)
345345
if not result:
346346
result = []
347347
return result

lib/pytap13.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _parse(self, source):
7070
if RE_YAMLISH_END.match(line):
7171
test = self.tests[-1]
7272
try:
73-
test.yaml = yaml.load(test._yaml_buffer.getvalue())
73+
test.yaml = yaml.safe_load(test._yaml_buffer.getvalue())
7474
except Exception as e:
7575
if not self.strict:
7676
continue

lib/tarantool_server.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,9 @@ def wait_until_started(self, wait_load=True):
805805
try:
806806
temp = AdminConnection('localhost', self.admin.port)
807807
if not wait_load:
808-
ans = yaml.load(temp.execute("2 + 2"))
808+
ans = yaml.safe_load(temp.execute("2 + 2"))
809809
return True
810-
ans = yaml.load(temp.execute('box.info.status'))[0]
810+
ans = yaml.safe_load(temp.execute('box.info.status'))[0]
811811
if ans in ('running', 'hot_standby', 'orphan'):
812812
return True
813813
elif ans in ('loading'):
@@ -897,8 +897,8 @@ def is_correct(run_name):
897897

898898
def get_param(self, param=None):
899899
if param is not None:
900-
return yaml.load(self.admin("box.info." + param, silent=True))[0]
901-
return yaml.load(self.admin("box.info", silent=True))
900+
return yaml.safe_load(self.admin("box.info." + param, silent=True))[0]
901+
return yaml.safe_load(self.admin("box.info", silent=True))
902902

903903
def get_lsn(self, node_id):
904904
nodes = self.get_param("vclock")

lib/worker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def parse_reproduce_file(filepath):
3636
return reproduce
3737
try:
3838
with open(filepath, 'r') as f:
39-
for task_id in yaml.load(f):
39+
for task_id in yaml.safe_load(f):
4040
task_name, task_conf = task_id
4141
reproduce.append((task_name, task_conf))
4242
except IOError:

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PyYAML==3.10
1+
PyYAML==5.1
22
argparse==1.1
33
msgpack-python==0.4.6
44
gevent==1.1b5

0 commit comments

Comments
 (0)