Skip to content

Commit 9e44d79

Browse files
committed
remove vulnerable eval
1 parent 7cf433e commit 9e44d79

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

config/GSA_prerun.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
import time
44
import requests
5+
import ast
56
try:
67
from urllib.error import URLError
78
except ImportError:
@@ -35,8 +36,8 @@ def check_solr_connection(retry=None):
3536
else:
3637
try:
3738
pythonified = str(connection.text).replace('true', 'True')
38-
eval(pythonified)
39-
except TypeError:
39+
ast.literal_eval(pythonified)
40+
except (ValueError, SyntaxError):
4041
pass
4142

4243

0 commit comments

Comments
 (0)