Skip to content

Commit b7dc679

Browse files
IanMatthewHuffIan Huff
andauthored
final bandit warning (#13314)
Co-authored-by: Ian Huff <[email protected]>
1 parent 48797c5 commit b7dc679

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

news/3 Code Health/13103.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bandit issues in vscode_datascience_helpers.

pythonFiles/vscode_datascience_helpers/kernel_launcher.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
import os
99
import sys
10-
from subprocess import Popen, PIPE
10+
11+
# See comment at the point of our use of Popen
12+
from subprocess import Popen, PIPE # nosec
1113

1214
from ipython_genutils.encoding import getdefaultencoding
1315
from ipython_genutils.py3compat import cast_bytes_py2
@@ -151,7 +153,9 @@ def launch_kernel(
151153
env["JPY_PARENT_PID"] = str(os.getpid())
152154

153155
try:
154-
proc = Popen(cmd, **kwargs)
156+
# Popen with shell=False (which is the default) is our safest way to launch a process here
157+
# this cmd does come from the jupyter kernelspec argv, but this is consistent with how jupyter works
158+
proc = Popen(cmd, **kwargs) # nosec
155159
except Exception as exc:
156160
msg = (
157161
"Failed to run command:\n{}\n" " PATH={!r}\n" " with kwargs:\n{!r}\n"

0 commit comments

Comments
 (0)