Skip to content

Commit 5e365a1

Browse files
authored
Merge pull request #236 from intel-innersource/bandit_check
Updated pmu-query.py script with Bandit security tool requirements
2 parents 71cf1dd + c2af0dd commit 5e365a1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scripts/pmu-query.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import urllib.parse
55
import json
66
import csv
7-
import subprocess
7+
# subprocess is used as multiplatform approach, usage is verified (20-07-2022)
8+
import subprocess # nosec
89
import sys
910
import platform
1011
import getopt
@@ -31,7 +32,8 @@
3132
sys.exit(-2)
3233

3334
if filename is None:
34-
map_file_raw = urllib.request.urlopen("https://download.01.org/perfmon/mapfile.csv").read().decode('utf-8')
35+
# vefified that link to mapfile.csv is safe and correct (20-07-2022)
36+
map_file_raw = urllib.request.urlopen("https://download.01.org/perfmon/mapfile.csv").read().decode('utf-8') # nosec
3537
map_dict = csv.DictReader(io.StringIO(map_file_raw), delimiter=',')
3638
map_file = []
3739
core_path = ""
@@ -67,7 +69,8 @@
6769
print(model)
6870

6971
if core_path:
70-
json_core_data = urllib.request.urlopen(
72+
# vefified that links, created on base of map_file are correct (20-07-2022)
73+
json_core_data = urllib.request.urlopen( # nosec
7174
"https://download.01.org/perfmon" + core_path
7275
)
7376
core_events = json.load(json_core_data)
@@ -79,7 +82,8 @@
7982
sys.exit(-1)
8083

8184
if offcore_path:
82-
json_offcore_data = urllib.request.urlopen(
85+
# vefified that links, created on base of map_file are correct (20-07-2022)
86+
json_offcore_data = urllib.request.urlopen( # nosec
8387
"https://download.01.org/perfmon" + offcore_path
8488
)
8589
offcore_events = json.load(json_offcore_data)

0 commit comments

Comments
 (0)