summaryrefslogtreecommitdiffstats
path: root/utils/test/result_collection_api/opnfv_testapi/dashboard/dashboard_utils.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-09-09 16:50:48 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-09-14 10:53:33 +0800
commitdd9e8643b72497eecdb4c80dc64f161b1562033b (patch)
tree29f8cd29a44ccac033bad571544df7aa3c487618 /utils/test/result_collection_api/opnfv_testapi/dashboard/dashboard_utils.py
parent21f8156390bfaba48f8427f5cda8515becf675b3 (diff)
Fix security issues of eval-s in testapi
results from security audit show risks and recommendations to fix them JIRA: RELENG-144 Change-Id: If128cc3ae230150a912b581dfb1ded543d851eb5 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/result_collection_api/opnfv_testapi/dashboard/dashboard_utils.py')
-rw-r--r--utils/test/result_collection_api/opnfv_testapi/dashboard/dashboard_utils.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/utils/test/result_collection_api/opnfv_testapi/dashboard/dashboard_utils.py b/utils/test/result_collection_api/opnfv_testapi/dashboard/dashboard_utils.py
index 121875d02..42c635846 100644
--- a/utils/test/result_collection_api/opnfv_testapi/dashboard/dashboard_utils.py
+++ b/utils/test/result_collection_api/opnfv_testapi/dashboard/dashboard_utils.py
@@ -14,7 +14,6 @@
#
# v0.1: basic example
#
-import os
import re
import sys
from functest2Dashboard import format_functest_for_dashboard, \
@@ -47,8 +46,8 @@ def check_dashboard_ready_project(test_project):
def check_dashboard_ready_case(project, case):
- cmd = "check_" + project + "_case_exist(case)"
- return eval(cmd)
+ cmd = "check_" + project + "_case_exist"
+ return globals()[cmd](case)
def get_dashboard_projects():
@@ -73,6 +72,5 @@ def get_dashboard_result(project, case, results=None):
# project: project name
# results: array of raw results pre-filterded
# according to the parameters of the request
- cmd = "format_" + project + "_for_dashboard(case,results)"
- res = eval(cmd)
- return res
+ cmd = "format_" + project + "_for_dashboard"
+ return globals()[cmd](case, results)