Skip to content

Commit 8a4a979

Browse files
committed
Added execution check
1 parent a0fcedb commit 8a4a979

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cli/views.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ def post(self, request):
1414
data = json.loads(request.body)
1515
args = data['args']
1616

17-
full_cmd = f"{py_command()} {sherlock_dir()}/sherlock {args}"
18-
proc = Popen(full_cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
19-
outs, errs = proc.communicate()
20-
output = outs if outs else errs
17+
if valid_args(args) == False:
18+
output = "Invalid argument string"
19+
else:
20+
full_cmd = f"{py_command()} {sherlock_dir()}/sherlock {args}"
21+
proc = Popen(full_cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
22+
outs, errs = proc.communicate()
23+
output = outs if outs else errs
24+
2125
return Response({'output': output})
2226

2327
class DataView(APIView):

0 commit comments

Comments
 (0)