The following issues were found
script/run-gn-format.py
12 issues
Line: 1
Column: 1
import os
import subprocess
import sys
from lib.util import get_buildtools_executable
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
# Helper to run gn format on multiple files
Reported by Pylint.
Line: 1
Column: 1
import os
import subprocess
import sys
from lib.util import get_buildtools_executable
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
# Helper to run gn format on multiple files
Reported by Pylint.
Line: 2
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import os
import subprocess
import sys
from lib.util import get_buildtools_executable
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
# Helper to run gn format on multiple files
Reported by Bandit.
Line: 11
Column: 1
# Helper to run gn format on multiple files
# (gn only formats a single file at a time)
def main():
new_env = os.environ.copy()
new_env['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
new_env['CHROMIUM_BUILDTOOLS_PATH'] = os.path.realpath(
os.path.join(SOURCE_ROOT, '..', 'buildtools')
)
Reported by Pylint.
Line: 12
Column: 1
# Helper to run gn format on multiple files
# (gn only formats a single file at a time)
def main():
new_env = os.environ.copy()
new_env['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
new_env['CHROMIUM_BUILDTOOLS_PATH'] = os.path.realpath(
os.path.join(SOURCE_ROOT, '..', 'buildtools')
)
Reported by Pylint.
Line: 13
Column: 1
# (gn only formats a single file at a time)
def main():
new_env = os.environ.copy()
new_env['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
new_env['CHROMIUM_BUILDTOOLS_PATH'] = os.path.realpath(
os.path.join(SOURCE_ROOT, '..', 'buildtools')
)
gn_path = get_buildtools_executable('gn')
Reported by Pylint.
Line: 14
Column: 1
def main():
new_env = os.environ.copy()
new_env['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
new_env['CHROMIUM_BUILDTOOLS_PATH'] = os.path.realpath(
os.path.join(SOURCE_ROOT, '..', 'buildtools')
)
gn_path = get_buildtools_executable('gn')
for gn_file in sys.argv[1:]:
Reported by Pylint.
Line: 18
Column: 1
os.path.join(SOURCE_ROOT, '..', 'buildtools')
)
gn_path = get_buildtools_executable('gn')
for gn_file in sys.argv[1:]:
subprocess.check_call(
[gn_path, 'format', gn_file],
env=new_env
)
Reported by Pylint.
Line: 19
Column: 1
)
gn_path = get_buildtools_executable('gn')
for gn_file in sys.argv[1:]:
subprocess.check_call(
[gn_path, 'format', gn_file],
env=new_env
)
Reported by Pylint.
Line: 20
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
gn_path = get_buildtools_executable('gn')
for gn_file in sys.argv[1:]:
subprocess.check_call(
[gn_path, 'format', gn_file],
env=new_env
)
if __name__ == '__main__':
Reported by Bandit.
build/mac/make_locale_dirs.py
12 issues
Line: 1
Column: 1
# usage: make_locale_dirs.py locale_dir [...]
#
# This script is intended to create empty locale directories (.lproj) in a
# Cocoa .app bundle. The presence of these empty directories is sufficient to
# convince Cocoa that the application supports the named localization, even if
# an InfoPlist.strings file is not provided. Chrome uses these empty locale
# directoires for its helper executable bundles, which do not otherwise
# require any direct Cocoa locale support.
Reported by Pylint.
Line: 15
Column: 1
import sys
def main(args):
for dirname in args:
try:
os.makedirs(dirname)
except OSError as e:
if e.errno == errno.EEXIST:
Reported by Pylint.
Line: 16
Column: 1
def main(args):
for dirname in args:
try:
os.makedirs(dirname)
except OSError as e:
if e.errno == errno.EEXIST:
# It's OK if it already exists
Reported by Pylint.
Line: 17
Column: 1
def main(args):
for dirname in args:
try:
os.makedirs(dirname)
except OSError as e:
if e.errno == errno.EEXIST:
# It's OK if it already exists
pass
Reported by Pylint.
Line: 18
Column: 1
def main(args):
for dirname in args:
try:
os.makedirs(dirname)
except OSError as e:
if e.errno == errno.EEXIST:
# It's OK if it already exists
pass
else:
Reported by Pylint.
Line: 19
Column: 1
for dirname in args:
try:
os.makedirs(dirname)
except OSError as e:
if e.errno == errno.EEXIST:
# It's OK if it already exists
pass
else:
raise
Reported by Pylint.
Line: 19
Column: 5
for dirname in args:
try:
os.makedirs(dirname)
except OSError as e:
if e.errno == errno.EEXIST:
# It's OK if it already exists
pass
else:
raise
Reported by Pylint.
Line: 20
Column: 1
try:
os.makedirs(dirname)
except OSError as e:
if e.errno == errno.EEXIST:
# It's OK if it already exists
pass
else:
raise
Reported by Pylint.
Line: 22
Column: 1
except OSError as e:
if e.errno == errno.EEXIST:
# It's OK if it already exists
pass
else:
raise
if __name__ == '__main__':
Reported by Pylint.
Line: 23
Column: 1
if e.errno == errno.EEXIST:
# It's OK if it already exists
pass
else:
raise
if __name__ == '__main__':
main(sys.argv[1:])
Reported by Pylint.
script/generate-zip-manifest.py
11 issues
Line: 14
Column: 12
return 0
if __name__ == '__main__':
sys.exit(main(*sys.argv[1:]))
Reported by Pylint.
Line: 14
Column: 12
return 0
if __name__ == '__main__':
sys.exit(main(*sys.argv[1:]))
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
import zipfile
import sys
def main(zip_path, manifest_out):
with open(manifest_out, 'w') as manifest, \
zipfile.ZipFile(zip_path, 'r', allowZip64=True) as z:
for name in sorted(z.namelist()):
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
import zipfile
import sys
def main(zip_path, manifest_out):
with open(manifest_out, 'w') as manifest, \
zipfile.ZipFile(zip_path, 'r', allowZip64=True) as z:
for name in sorted(z.namelist()):
Reported by Pylint.
Line: 6
Column: 1
import zipfile
import sys
def main(zip_path, manifest_out):
with open(manifest_out, 'w') as manifest, \
zipfile.ZipFile(zip_path, 'r', allowZip64=True) as z:
for name in sorted(z.namelist()):
manifest.write(name + '\n')
return 0
Reported by Pylint.
Line: 7
Column: 1
import sys
def main(zip_path, manifest_out):
with open(manifest_out, 'w') as manifest, \
zipfile.ZipFile(zip_path, 'r', allowZip64=True) as z:
for name in sorted(z.namelist()):
manifest.write(name + '\n')
return 0
Reported by Pylint.
Line: 8
Column: 58
def main(zip_path, manifest_out):
with open(manifest_out, 'w') as manifest, \
zipfile.ZipFile(zip_path, 'r', allowZip64=True) as z:
for name in sorted(z.namelist()):
manifest.write(name + '\n')
return 0
if __name__ == '__main__':
Reported by Pylint.
Line: 9
Column: 1
def main(zip_path, manifest_out):
with open(manifest_out, 'w') as manifest, \
zipfile.ZipFile(zip_path, 'r', allowZip64=True) as z:
for name in sorted(z.namelist()):
manifest.write(name + '\n')
return 0
if __name__ == '__main__':
sys.exit(main(*sys.argv[1:]))
Reported by Pylint.
Line: 10
Column: 1
with open(manifest_out, 'w') as manifest, \
zipfile.ZipFile(zip_path, 'r', allowZip64=True) as z:
for name in sorted(z.namelist()):
manifest.write(name + '\n')
return 0
if __name__ == '__main__':
sys.exit(main(*sys.argv[1:]))
Reported by Pylint.
Line: 11
Column: 1
zipfile.ZipFile(zip_path, 'r', allowZip64=True) as z:
for name in sorted(z.namelist()):
manifest.write(name + '\n')
return 0
if __name__ == '__main__':
sys.exit(main(*sys.argv[1:]))
Reported by Pylint.
build/js2c.py
10 issues
Line: 1
Column: 1
#!/usr/bin/env python
import os
import subprocess
import sys
TEMPLATE = """
#include "node_native_module.h"
#include "node_internals.h"
Reported by Pylint.
Line: 4
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
#!/usr/bin/env python
import os
import subprocess
import sys
TEMPLATE = """
#include "node_native_module.h"
#include "node_internals.h"
Reported by Bandit.
Line: 26
Column: 1
}} // namespace node
"""
def main():
node_path = os.path.abspath(sys.argv[1])
natives = os.path.abspath(sys.argv[2])
js_source_files = sys.argv[3:]
js2c = os.path.join(node_path, 'tools', 'js2c.py')
Reported by Pylint.
Line: 27
Column: 1
"""
def main():
node_path = os.path.abspath(sys.argv[1])
natives = os.path.abspath(sys.argv[2])
js_source_files = sys.argv[3:]
js2c = os.path.join(node_path, 'tools', 'js2c.py')
subprocess.check_call(
Reported by Pylint.
Line: 28
Column: 1
def main():
node_path = os.path.abspath(sys.argv[1])
natives = os.path.abspath(sys.argv[2])
js_source_files = sys.argv[3:]
js2c = os.path.join(node_path, 'tools', 'js2c.py')
subprocess.check_call(
[sys.executable, js2c] +
Reported by Pylint.
Line: 29
Column: 1
def main():
node_path = os.path.abspath(sys.argv[1])
natives = os.path.abspath(sys.argv[2])
js_source_files = sys.argv[3:]
js2c = os.path.join(node_path, 'tools', 'js2c.py')
subprocess.check_call(
[sys.executable, js2c] +
js_source_files +
Reported by Pylint.
Line: 31
Column: 1
natives = os.path.abspath(sys.argv[2])
js_source_files = sys.argv[3:]
js2c = os.path.join(node_path, 'tools', 'js2c.py')
subprocess.check_call(
[sys.executable, js2c] +
js_source_files +
['--only-js', '--target', natives])
Reported by Pylint.
Line: 32
Column: 1
js_source_files = sys.argv[3:]
js2c = os.path.join(node_path, 'tools', 'js2c.py')
subprocess.check_call(
[sys.executable, js2c] +
js_source_files +
['--only-js', '--target', natives])
Reported by Pylint.
Line: 32
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
js_source_files = sys.argv[3:]
js2c = os.path.join(node_path, 'tools', 'js2c.py')
subprocess.check_call(
[sys.executable, js2c] +
js_source_files +
['--only-js', '--target', natives])
Reported by Bandit.
Line: 39
Column: 1
if __name__ == '__main__':
sys.exit(main())
Reported by Pylint.
build/strip_framework.py
10 issues
Line: 1
Column: 1
#!/usr/bin/env python
import os
import subprocess
import sys
source = sys.argv[1]
dest = sys.argv[2]
# Ensure any existing framework is removed
Reported by Pylint.
Line: 3
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
#!/usr/bin/env python
import os
import subprocess
import sys
source = sys.argv[1]
dest = sys.argv[2]
# Ensure any existing framework is removed
Reported by Bandit.
Line: 10
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html
dest = sys.argv[2]
# Ensure any existing framework is removed
subprocess.check_output(["rm", "-rf", dest])
subprocess.check_output(["cp", "-a", source, dest])
# Strip headers, we do not need to ship them
subprocess.check_output(["rm", "-r", os.path.join(dest, "Headers")])
Reported by Bandit.
Line: 10
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
dest = sys.argv[2]
# Ensure any existing framework is removed
subprocess.check_output(["rm", "-rf", dest])
subprocess.check_output(["cp", "-a", source, dest])
# Strip headers, we do not need to ship them
subprocess.check_output(["rm", "-r", os.path.join(dest, "Headers")])
Reported by Bandit.
Line: 12
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
# Ensure any existing framework is removed
subprocess.check_output(["rm", "-rf", dest])
subprocess.check_output(["cp", "-a", source, dest])
# Strip headers, we do not need to ship them
subprocess.check_output(["rm", "-r", os.path.join(dest, "Headers")])
subprocess.check_output(
["rm", "-r", os.path.join(dest, "Versions", "Current", "Headers")]
Reported by Bandit.
Line: 12
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html
# Ensure any existing framework is removed
subprocess.check_output(["rm", "-rf", dest])
subprocess.check_output(["cp", "-a", source, dest])
# Strip headers, we do not need to ship them
subprocess.check_output(["rm", "-r", os.path.join(dest, "Headers")])
subprocess.check_output(
["rm", "-r", os.path.join(dest, "Versions", "Current", "Headers")]
Reported by Bandit.
Line: 15
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
subprocess.check_output(["cp", "-a", source, dest])
# Strip headers, we do not need to ship them
subprocess.check_output(["rm", "-r", os.path.join(dest, "Headers")])
subprocess.check_output(
["rm", "-r", os.path.join(dest, "Versions", "Current", "Headers")]
)
Reported by Bandit.
Line: 15
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html
subprocess.check_output(["cp", "-a", source, dest])
# Strip headers, we do not need to ship them
subprocess.check_output(["rm", "-r", os.path.join(dest, "Headers")])
subprocess.check_output(
["rm", "-r", os.path.join(dest, "Versions", "Current", "Headers")]
)
Reported by Bandit.
Line: 16
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html
# Strip headers, we do not need to ship them
subprocess.check_output(["rm", "-r", os.path.join(dest, "Headers")])
subprocess.check_output(
["rm", "-r", os.path.join(dest, "Versions", "Current", "Headers")]
)
Reported by Bandit.
Line: 16
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
# Strip headers, we do not need to ship them
subprocess.check_output(["rm", "-r", os.path.join(dest, "Headers")])
subprocess.check_output(
["rm", "-r", os.path.join(dest, "Versions", "Current", "Headers")]
)
Reported by Bandit.
build/generate-template.py
8 issues
Line: 1
Column: 1
import json
import sys
from string import Template
inpath = sys.argv[1]
outpath = sys.argv[2]
argpaths = sys.argv[3:]
with open(inpath, 'r') as infile, open(outpath, 'w') as outfile:
Reported by Pylint.
Line: 1
Column: 1
import json
import sys
from string import Template
inpath = sys.argv[1]
outpath = sys.argv[2]
argpaths = sys.argv[3:]
with open(inpath, 'r') as infile, open(outpath, 'w') as outfile:
Reported by Pylint.
Line: 10
Column: 1
argpaths = sys.argv[3:]
with open(inpath, 'r') as infile, open(outpath, 'w') as outfile:
data = {}
for argpath in argpaths:
with open(argpath, 'r') as argfile:
data.update(json.load(argfile))
s = Template(infile.read()).substitute(data)
Reported by Pylint.
Line: 11
Column: 1
with open(inpath, 'r') as infile, open(outpath, 'w') as outfile:
data = {}
for argpath in argpaths:
with open(argpath, 'r') as argfile:
data.update(json.load(argfile))
s = Template(infile.read()).substitute(data)
outfile.write(s)
Reported by Pylint.
Line: 12
Column: 1
with open(inpath, 'r') as infile, open(outpath, 'w') as outfile:
data = {}
for argpath in argpaths:
with open(argpath, 'r') as argfile:
data.update(json.load(argfile))
s = Template(infile.read()).substitute(data)
outfile.write(s)
Reported by Pylint.
Line: 13
Column: 1
data = {}
for argpath in argpaths:
with open(argpath, 'r') as argfile:
data.update(json.load(argfile))
s = Template(infile.read()).substitute(data)
outfile.write(s)
Reported by Pylint.
Line: 15
Column: 1
with open(argpath, 'r') as argfile:
data.update(json.load(argfile))
s = Template(infile.read()).substitute(data)
outfile.write(s)
Reported by Pylint.
Line: 16
Column: 1
data.update(json.load(argfile))
s = Template(infile.read()).substitute(data)
outfile.write(s)
Reported by Pylint.
build/run-node.py
8 issues
Line: 1
Column: 1
import os
import subprocess
import sys
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
def main():
# Proxy all args to node script
Reported by Pylint.
Line: 1
Column: 1
import os
import subprocess
import sys
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
def main():
# Proxy all args to node script
Reported by Pylint.
Line: 2
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import os
import subprocess
import sys
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
def main():
# Proxy all args to node script
Reported by Bandit.
Line: 8
Column: 1
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
def main():
# Proxy all args to node script
script = os.path.join(SOURCE_ROOT, sys.argv[1])
subprocess.check_call(['node', script] + [str(x) for x in sys.argv[2:]])
if __name__ == '__main__':
Reported by Pylint.
Line: 10
Column: 1
def main():
# Proxy all args to node script
script = os.path.join(SOURCE_ROOT, sys.argv[1])
subprocess.check_call(['node', script] + [str(x) for x in sys.argv[2:]])
if __name__ == '__main__':
sys.exit(main())
Reported by Pylint.
Line: 11
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
def main():
# Proxy all args to node script
script = os.path.join(SOURCE_ROOT, sys.argv[1])
subprocess.check_call(['node', script] + [str(x) for x in sys.argv[2:]])
if __name__ == '__main__':
sys.exit(main())
Reported by Bandit.
Line: 11
Column: 1
def main():
# Proxy all args to node script
script = os.path.join(SOURCE_ROOT, sys.argv[1])
subprocess.check_call(['node', script] + [str(x) for x in sys.argv[2:]])
if __name__ == '__main__':
sys.exit(main())
Reported by Pylint.
Line: 14
Column: 1
subprocess.check_call(['node', script] + [str(x) for x in sys.argv[2:]])
if __name__ == '__main__':
sys.exit(main())
Reported by Pylint.
build/run-in-dir.py
8 issues
Line: 1
Column: 1
import sys
import os
def main(argv):
cwd = argv[1]
os.chdir(cwd)
os.execv(sys.executable, [sys.executable] + argv[2:])
if __name__ == '__main__':
Reported by Pylint.
Line: 1
Column: 1
import sys
import os
def main(argv):
cwd = argv[1]
os.chdir(cwd)
os.execv(sys.executable, [sys.executable] + argv[2:])
if __name__ == '__main__':
Reported by Pylint.
Line: 4
Column: 1
import sys
import os
def main(argv):
cwd = argv[1]
os.chdir(cwd)
os.execv(sys.executable, [sys.executable] + argv[2:])
if __name__ == '__main__':
Reported by Pylint.
Line: 5
Column: 1
import os
def main(argv):
cwd = argv[1]
os.chdir(cwd)
os.execv(sys.executable, [sys.executable] + argv[2:])
if __name__ == '__main__':
main(sys.argv)
Reported by Pylint.
Line: 6
Column: 1
def main(argv):
cwd = argv[1]
os.chdir(cwd)
os.execv(sys.executable, [sys.executable] + argv[2:])
if __name__ == '__main__':
main(sys.argv)
Reported by Pylint.
Line: 7
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b606_start_process_with_no_shell.html
def main(argv):
cwd = argv[1]
os.chdir(cwd)
os.execv(sys.executable, [sys.executable] + argv[2:])
if __name__ == '__main__':
main(sys.argv)
Reported by Bandit.
Line: 7
Column: 1
def main(argv):
cwd = argv[1]
os.chdir(cwd)
os.execv(sys.executable, [sys.executable] + argv[2:])
if __name__ == '__main__':
main(sys.argv)
Reported by Pylint.
Line: 10
Column: 1
os.execv(sys.executable, [sys.executable] + argv[2:])
if __name__ == '__main__':
main(sys.argv)
Reported by Pylint.
build/npm-run.py
7 issues
Line: 1
Column: 1
#!/usr/bin/env python
from __future__ import print_function
import os
import subprocess
import sys
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
cmd = "npm"
if sys.platform == "win32":
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
from __future__ import print_function
import os
import subprocess
import sys
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
cmd = "npm"
if sys.platform == "win32":
Reported by Pylint.
Line: 4
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
#!/usr/bin/env python
from __future__ import print_function
import os
import subprocess
import sys
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
cmd = "npm"
if sys.platform == "win32":
Reported by Bandit.
Line: 8
Column: 1
import sys
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
cmd = "npm"
if sys.platform == "win32":
cmd += ".cmd"
args = [cmd, "run",
"--prefix",
SOURCE_ROOT
Reported by Pylint.
Line: 16
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
SOURCE_ROOT
] + sys.argv[1:]
try:
subprocess.check_output(args, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
error_msg = "NPM script '{}' failed with code '{}':\n".format(sys.argv[2], e.returncode)
print(error_msg + e.output.decode('utf8'))
sys.exit(e.returncode)
Reported by Bandit.
Line: 17
Column: 1
] + sys.argv[1:]
try:
subprocess.check_output(args, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
error_msg = "NPM script '{}' failed with code '{}':\n".format(sys.argv[2], e.returncode)
print(error_msg + e.output.decode('utf8'))
sys.exit(e.returncode)
Reported by Pylint.
Line: 18
Column: 5
try:
subprocess.check_output(args, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
error_msg = "NPM script '{}' failed with code '{}':\n".format(sys.argv[2], e.returncode)
print(error_msg + e.output.decode('utf8'))
sys.exit(e.returncode)
Reported by Pylint.
script/dbus_mock.py
6 issues
Line: 7
Column: 1
import subprocess
import sys
from dbusmock import DBusTestCase
from lib.config import is_verbose_mode
def stop():
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
import os
import subprocess
import sys
from dbusmock import DBusTestCase
from lib.config import is_verbose_mode
Reported by Pylint.
Line: 4
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
#!/usr/bin/env python
import os
import subprocess
import sys
from dbusmock import DBusTestCase
from lib.config import is_verbose_mode
Reported by Bandit.
Line: 11
Column: 1
from lib.config import is_verbose_mode
def stop():
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)
def start():
log = sys.stdout if is_verbose_mode() else open(os.devnull, 'w')
Reported by Pylint.
Line: 15
Column: 1
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)
def start():
log = sys.stdout if is_verbose_mode() else open(os.devnull, 'w')
DBusTestCase.start_system_bus()
DBusTestCase.spawn_server_template('logind', None, log)
Reported by Pylint.
Line: 27
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
if __name__ == '__main__':
start()
try:
subprocess.check_call(sys.argv[1:])
finally:
stop()
Reported by Bandit.