The following issues were found
buildscripts/resmokelib/testing/hooks/stepdown.py
1 issues
Line: 514
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random
def step_up_secondary():
while secondaries:
chosen = random.choice(secondaries)
if not rs_fixture.stepup_node(chosen, self._auth_options):
secondaries.remove(chosen)
else:
return chosen
Reported by Bandit.
buildscripts/resmokelib/testing/testcases/dbtest.py
1 issues
Line: 77
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b108_hardcoded_tmp_directory.html
for env_var in ("TMPDIR", "TEMP", "TMP"):
if env_var in os.environ:
return os.environ[env_var]
return os.path.normpath("/tmp")
Reported by Bandit.
buildscripts/resmokelib/testing/testcases/fsm_workload_test.py
1 issues
Line: 97
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5
@staticmethod
def get_workload_uid(selected_tests):
"""Get an unique identifier for a workload group."""
uid = hashlib.md5()
for workload_name in sorted(selected_tests):
uid.update(workload_name.encode("utf-8"))
return uid.hexdigest()
Reported by Bandit.
buildscripts/resmokelib/testing/testcases/pytest.py
1 issues
Line: 16
Column: 5
def __init__(self, logger, py_filename):
"""Initialize PyTestCase."""
interface.ProcessTestCase.__init__(self, logger, "PyTest", py_filename)
def _make_process(self):
return core.programs.generic_program(
self.logger, [sys.executable, "-m", "unittest", self.test_module_name], 0,
test_id=self._id)
Reported by Pylint.
buildscripts/resmokelib/undodb/__init__.py
1 issues
Line: 4
Column: 1
"""Interactions with the undodb tool-suite."""
from buildscripts.resmokelib.plugin import PluginInterface, Subcommand
from . import fetch
_HELP = """
Info on how to install undodb.
"""
Reported by Pylint.
buildscripts/resmokelib/utils/queue.py
1 issues
Line: 9
Column: 1
See https://bugs.python.org/issue1167930 for more details.
"""
import queue as _queue
import time
# Exception that is raised when get_nowait() is called on an empty Queue.
Empty = _queue.Empty # pylint: disable=invalid-name
Reported by Pylint.
buildscripts/testmatrix/getdisplaytaskname.py
1 issues
Line: 4
Column: 1
"""
Get the display task name from the execution task and the variant.
Get an execution task name like this: multiversion_auth_0_enterprise-rhel-80-64-bit-dynamic-all-feature-flags-required
Into a display task name like this: multiversion_auth
"""
import sys
Reported by Pylint.
buildscripts/tests/data/errorcodes/regex_matching/regex_matching.cpp
1 issues
Line: 28
LOGV2_ERROR(25,
"words"
"more words");
LOGV2_ERROR(26,
"words",
"comma, more words words words words words words words words words words words words "
Reported by Cppcheck.
buildscripts/tests/resmokelib/utils/test_archival.py
1 issues
Line: 21
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random
""" Creates file with random characters, which will have minimal compression. """
with open(file_name, "wb") as fileh:
for _ in range(num_chars_mb * 1024 * 1024):
fileh.write(chr(random.randint(0, 255)))
class MockS3Client(object):
""" Class to mock the S3 client. """
Reported by Bandit.
buildscripts/tests/test_burn_in_tests.py
1 issues
Line: 9
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import datetime
import os
import sys
import subprocess
import unittest
from mock import Mock, patch, MagicMock
import buildscripts.burn_in_tests as under_test
Reported by Bandit.