The following issues were found

buildscripts/idl/tests/testcase.py
1 issues
Attempted relative import beyond top-level package
Error

Line: 39 Column: 5

                  sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
    from context import idl
else:
    from .context import idl


def errors_to_str(errors):
    # type: (idl.errors.ParserErrorCollection) -> str
    """Dump the list of errors as a multiline text string."""

            

Reported by Pylint.

buildscripts/mongosymb_multithread.py
1 issues
Consider possible security implications associated with subprocess module.
Security blacklist

Line: 11
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              import argparse
import json
import re
import subprocess
import sys
import mongosymb


def main():

            

Reported by Bandit.

buildscripts/resmokelib/configure_resmoke.py
1 issues
Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 249
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

              
    if _config.FUZZ_MONGOD_CONFIGS:
        if not _config.CONFIG_FUZZ_SEED:
            _config.CONFIG_FUZZ_SEED = random.randrange(sys.maxsize)
        else:
            _config.CONFIG_FUZZ_SEED = int(_config.CONFIG_FUZZ_SEED)
        _config.MONGOD_SET_PARAMETERS, _config.WT_ENGINE_CONFIG = mongod_fuzzer_configs \
            .fuzz_set_parameters(_config.CONFIG_FUZZ_SEED, _config.MONGOD_SET_PARAMETERS)


            

Reported by Bandit.

buildscripts/resmokelib/hang_analyzer/dumper.py
1 issues
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 145
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
    def _process_specific(self, pinfo, take_dump, logger=None):
        """Return the commands that attach to each process, dump info and detach."""
        assert isinstance(pinfo.pidv, int)

        if take_dump:
            # Dump to file, dump_<process name>.<pid>.mdmp
            dump_file = "dump_%s.%d.%s" % (os.path.splitext(pinfo.name)[0], pinfo.pidv,
                                           self.get_dump_ext())

            

Reported by Bandit.

buildscripts/resmokelib/logging/buildlogger.py
1 issues
Use of exec detected.
Security

Line: 268
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

                      """Initialize BuildloggerServer."""
        tmp_globals = {}
        self.config = {}
        exec(
            compile(open(_BUILDLOGGER_CONFIG, "rb").read(), _BUILDLOGGER_CONFIG, 'exec'),
            tmp_globals, self.config)

        # Rename "slavename" to "username" if present.
        if "slavename" in self.config and "username" not in self.config:

            

Reported by Bandit.

buildscripts/resmokelib/logging/handlers.py
1 issues
Unexpected keyword argument 'allowed_methods' in constructor call
Error

Line: 176 Column: 21

              
        if should_retry:
            retry_status = [500, 502, 503, 504]  # Retry for these statuses.
            retry = urllib3_retry.Retry(
                backoff_factor=0.1,  # Enable backoff starting at 0.1s.
                allowed_methods=False,  # Support all HTTP verbs.
                status_forcelist=retry_status)

            adapter = requests.adapters.HTTPAdapter(max_retries=retry)

            

Reported by Pylint.

buildscripts/resmokelib/logging/loggers.py
1 issues
Consider possible security implications associated with subprocess module.
Security blacklist

Line: 6
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              import logging
import re
import shutil
import subprocess
import sys

from buildscripts.resmokelib import config
from buildscripts.resmokelib import errors
from buildscripts.resmokelib.core import redirect as redirect_lib

            

Reported by Bandit.

buildscripts/resmokelib/testing/fixtures/replicaset.py
1 issues
Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 569
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

                              # elect a new primary.
                return False

        should_kill = kill and random.choice([True, False])
        action = "Killing" if should_kill else "Terminating"
        self.logger.info("%s the primary on port %d of replica set '%s'.", action, primary.port,
                         self.replset_name)

        # We send the mongod process the signal to exit but don't immediately wait for it to

            

Reported by Bandit.

buildscripts/resmokelib/testing/hooks/change_streams.py
1 issues
Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 28
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

                      self._change_streams_thread = None
        self._test_run = None
        random.seed(config.RANDOM_SEED)
        self._every_n_tests = random.randint(1, 10)
        self._full_suite_changes_num = 0

    def before_suite(self, test_report):
        """Print the log message."""
        self.logger.info("Opening and closing change streams every %d tests. The seed is %d.",

            

Reported by Bandit.

buildscripts/resmokelib/testing/hooks/initialsync.py
1 issues
Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 106
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

              
                # If we have not restarted initial sync since the last time we ran the data
                # validation, restart initial sync with a 20% probability.
                if self._hook.random_restarts < 1 and random.random() < 0.2:
                    self.logger.info(
                        "randomly restarting initial sync in the middle of initial sync")
                    self.__restart_init_sync(sync_node)
                    self._hook.random_restarts += 1
                return

            

Reported by Bandit.