summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaveme <zhangmei.li@easystack.cn>2016-02-11 14:22:23 +0800
committerJaveme <zhangmei.li@easystack.cn>2016-02-11 14:35:24 +0800
commit668062ed07eaba096ec17363bd3f5721707b960b (patch)
tree142fe5e98c8d080ae6ed7a2907a8f58acc339bbb
parent1cc3b9c80e948b5f7052ac76f03d31a143269cf6 (diff)
downloadoslo-messaging-668062ed07eaba096ec17363bd3f5721707b960b.tar.gz
Use more secure yaml.safe_load() instead of yaml.load()
The function yaml.load() provides the ability to construct an arbitrary Python object. For security, we use yaml.safe_load() instead which limits this ability to simple Python objects(like integers or lists). ref: https://en.wikipedia.org/wiki/YAML#Security Change-Id: Iea2a2d79c764d635b02c5d6d36c9a5652010d716
-rwxr-xr-xtools/simulator.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/simulator.py b/tools/simulator.py
index 872ac0e..8c5c85e 100755
--- a/tools/simulator.py
+++ b/tools/simulator.py
@@ -54,7 +54,7 @@ Usage example:
def init_random_generator():
data = []
with open('./messages_length.yaml') as m_file:
- content = yaml.load(m_file)
+ content = yaml.safe_load(m_file)
data += [int(n) for n in content[
'test_data']['string_lengths'].split(', ')]