The following issues were found

site_scons/mongo/generators.py
10 issues
Unused argument 'target'
Error

Line: 91 Column: 35

                  return {}


def default_variant_dir_generator(target, source, env, for_signature):

    if env.GetOption('cache') != None:
        return 'cached'

    # If an option should affect the variant directory, name it here.

            

Reported by Pylint.

Unused argument 'source'
Error

Line: 91 Column: 43

                  return {}


def default_variant_dir_generator(target, source, env, for_signature):

    if env.GetOption('cache') != None:
        return 'cached'

    # If an option should affect the variant directory, name it here.

            

Reported by Pylint.

Unused argument 'for_signature'
Error

Line: 91 Column: 56

                  return {}


def default_variant_dir_generator(target, source, env, for_signature):

    if env.GetOption('cache') != None:
        return 'cached'

    # If an option should affect the variant directory, name it here.

            

Reported by Pylint.

Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Security blacklist

Line: 104
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5

              
    # Hash the named options and their values, and take the first 8 characters of the hash as
    # the variant name
    hasher = hashlib.md5()
    for option in variant_options:
        hasher.update(option.encode('utf-8'))
        hasher.update(str(env.GetOption(option)).encode('utf-8'))
    variant_dir = str(hasher.hexdigest()[0:8])


            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              # -*- mode: python; -*-

import hashlib

# Default and alternative generator definitions go here.

# This is the key/value mapping that will be returned by the buildInfo command and
# printed by the --version command-line option to mongod.
# Each mapped value is in turn a dict consisting of:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 1

              #   inVersion: <bool> : should it be included in --version output
# The `value` field will be passed through env.subst, so you can use any SCons variables you
# want to define them.
def default_buildinfo_environment_data():
    data = (
        (
            'distmod',
            '$MONGO_DISTMOD',
            True,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 87 Column: 1

              
# If you want buildInfo and --version to be relatively empty, set
# MONGO_BUILDINFO_ENVIRONMENT_DATA = empty_buildinfo_environment_data()
def empty_buildinfo_environment_data():
    return {}


def default_variant_dir_generator(target, source, env, for_signature):


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 91 Column: 1

                  return {}


def default_variant_dir_generator(target, source, env, for_signature):

    if env.GetOption('cache') != None:
        return 'cached'

    # If an option should affect the variant directory, name it here.

            

Reported by Pylint.

Comparison 'env.GetOption('cache') != None' should be 'env.GetOption('cache') is not None'
Error

Line: 93 Column: 8

              
def default_variant_dir_generator(target, source, env, for_signature):

    if env.GetOption('cache') != None:
        return 'cached'

    # If an option should affect the variant directory, name it here.
    variant_options = [
        'opt',

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 122 Column: 1

                  return known_variant_hashes.get(variant_dir, variant_dir)


def os_specific_variant_dir_generator(target, source, env, for_signature):
    return '-'.join([
        env['TARGET_OS'],
        default_variant_dir_generator(target, source, env, for_signature)])

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_cursor14.py
10 issues
Unable to import 'wiredtiger'
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios

# test_cursor14.py
#    Test that more than 64K cursors can be opened on a data source

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios

# test_cursor14.py
#    Test that more than 64K cursors can be opened on a data source

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 56 Column: 13

                      ds = self.dataset(self, uri, 100, key_format=self.keyfmt)
        ds.populate()

        for i in range(66000):
            cursor = self.session.open_cursor(uri, None, None)

if __name__ == '__main__':
    wttest.run()

            

Reported by Pylint.

Unused variable 'cursor'
Error

Line: 57 Column: 13

                      ds.populate()

        for i in range(66000):
            cursor = self.session.open_cursor(uri, None, None)

if __name__ == '__main__':
    wttest.run()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios

# test_cursor14.py
#    Test that more than 64K cursors can be opened on a data source

            

Reported by Pylint.

Missing class docstring
Error

Line: 35 Column: 1

              
# test_cursor14.py
#    Test that more than 64K cursors can be opened on a data source
class test_cursor14(wttest.WiredTigerTestCase):
    scenarios = make_scenarios([
        ('file-r', dict(type='file:', keyfmt='r', dataset=SimpleDataSet)),
        ('file-S', dict(type='file:', keyfmt='S', dataset=SimpleDataSet)),
        ('lsm-S', dict(type='lsm:', keyfmt='S', dataset=SimpleDataSet)),
        ('table-r', dict(type='table:', keyfmt='r', dataset=SimpleDataSet)),

            

Reported by Pylint.

Class name "test_cursor14" doesn't conform to PascalCase naming style
Error

Line: 35 Column: 1

              
# test_cursor14.py
#    Test that more than 64K cursors can be opened on a data source
class test_cursor14(wttest.WiredTigerTestCase):
    scenarios = make_scenarios([
        ('file-r', dict(type='file:', keyfmt='r', dataset=SimpleDataSet)),
        ('file-S', dict(type='file:', keyfmt='S', dataset=SimpleDataSet)),
        ('lsm-S', dict(type='lsm:', keyfmt='S', dataset=SimpleDataSet)),
        ('table-r', dict(type='table:', keyfmt='r', dataset=SimpleDataSet)),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 50 Column: 5

                          dataset=ComplexLSMDataSet)),
    ])

    def test_cursor14(self):
        uri = self.type + 'cursor14'

        ds = self.dataset(self, uri, 100, key_format=self.keyfmt)
        ds.populate()


            

Reported by Pylint.

Variable name "ds" doesn't conform to snake_case naming style
Error

Line: 53 Column: 9

                  def test_cursor14(self):
        uri = self.type + 'cursor14'

        ds = self.dataset(self, uri, 100, key_format=self.keyfmt)
        ds.populate()

        for i in range(66000):
            cursor = self.session.open_cursor(uri, None, None)


            

Reported by Pylint.

src/third_party/boost/boost/regex/config/cwchar.hpp
10 issues
wcscpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 175 Column: 8 CWE codes: 120
Suggestion: Consider using a function version that stops copying at the end of the buffer

              using ::wcscoll;
#endif

#ifdef wcscpy
inline wchar_t *(wcscpy)(wchar_t *p1, const wchar_t *p2)
{ return wcscpy(p1,p2); }
#undef wcscpy
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::wcscpy;

            

Reported by FlawFinder.

wcscpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 176 Column: 18 CWE codes: 120
Suggestion: Consider using a function version that stops copying at the end of the buffer

              #endif

#ifdef wcscpy
inline wchar_t *(wcscpy)(wchar_t *p1, const wchar_t *p2)
{ return wcscpy(p1,p2); }
#undef wcscpy
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::wcscpy;
#endif

            

Reported by FlawFinder.

wcscpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 177 Column: 10 CWE codes: 120
Suggestion: Consider using a function version that stops copying at the end of the buffer

              
#ifdef wcscpy
inline wchar_t *(wcscpy)(wchar_t *p1, const wchar_t *p2)
{ return wcscpy(p1,p2); }
#undef wcscpy
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::wcscpy;
#endif


            

Reported by FlawFinder.

wcscpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 178 Column: 8 CWE codes: 120
Suggestion: Consider using a function version that stops copying at the end of the buffer

              #ifdef wcscpy
inline wchar_t *(wcscpy)(wchar_t *p1, const wchar_t *p2)
{ return wcscpy(p1,p2); }
#undef wcscpy
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::wcscpy;
#endif

#ifdef wcslen

            

Reported by FlawFinder.

wcscpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 180 Column: 9 CWE codes: 120
Suggestion: Consider using a function version that stops copying at the end of the buffer

              { return wcscpy(p1,p2); }
#undef wcscpy
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::wcscpy;
#endif

#ifdef wcslen
inline size_t (wcslen)(const wchar_t *p)
{ return wcslen(p); }

            

Reported by FlawFinder.

wcslen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 183 Column: 8 CWE codes: 126

              using ::wcscpy;
#endif

#ifdef wcslen
inline size_t (wcslen)(const wchar_t *p)
{ return wcslen(p); }
#undef wcslen
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::wcslen;

            

Reported by FlawFinder.

wcslen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 184 Column: 16 CWE codes: 126

              #endif

#ifdef wcslen
inline size_t (wcslen)(const wchar_t *p)
{ return wcslen(p); }
#undef wcslen
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::wcslen;
#endif

            

Reported by FlawFinder.

wcslen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 185 Column: 10 CWE codes: 126

              
#ifdef wcslen
inline size_t (wcslen)(const wchar_t *p)
{ return wcslen(p); }
#undef wcslen
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::wcslen;
#endif


            

Reported by FlawFinder.

wcslen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 186 Column: 8 CWE codes: 126

              #ifdef wcslen
inline size_t (wcslen)(const wchar_t *p)
{ return wcslen(p); }
#undef wcslen
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::wcslen;
#endif

#ifdef wcsxfrm

            

Reported by FlawFinder.

wcslen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 188 Column: 9 CWE codes: 126

              { return wcslen(p); }
#undef wcslen
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::wcslen;
#endif

#ifdef wcsxfrm
size_t wcsxfrm(wchar_t *p1, const wchar_t *p2, size_t s)
{ return wcsxfrm(p1,p2,s); }

            

Reported by FlawFinder.

src/third_party/mozjs-60/extract/js/src/wasm/AsmJS.cpp
10 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 8588 Column: 10 CWE codes: 362

                                          moduleChars.serializedSize();

    JS::OpenAsmJSCacheEntryForWriteOp open = cx->asmJSCacheOps().openEntryForWrite;
    if (!open)
        return JS::AsmJSCache_Disabled_Internal;

    const char16_t* begin = parser.tokenStream.rawCharPtrAt(ModuleChars::beginOffset(parser));
    const char16_t* end = parser.tokenStream.rawCharPtrAt(ModuleChars::endOffset(parser));


            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 8596 Column: 9 CWE codes: 362

              
    ScopedCacheEntryOpenedForWrite entry(cx, serializedSize);
    JS::AsmJSCacheResult openResult =
        open(cx->global(), begin, end, serializedSize, &entry.memory, &entry.handle);
    if (openResult != JS::AsmJSCache_Success)
        return openResult;

    uint8_t* cursor = entry.memory;


            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 8627 Column: 10 CWE codes: 362

                  *loadedFromCache = false;

    JS::OpenAsmJSCacheEntryForReadOp open = cx->asmJSCacheOps().openEntryForRead;
    if (!open)
        return true;

    const char16_t* begin = parser.tokenStream.rawCharPtrAt(ModuleChars::beginOffset(parser));
    const char16_t* limit = parser.tokenStream.rawLimit();


            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 8634 Column: 10 CWE codes: 362

                  const char16_t* limit = parser.tokenStream.rawLimit();

    ScopedCacheEntryOpenedForRead entry(cx);
    if (!open(cx->global(), begin, limit, &entry.serializedSize, &entry.memory, &entry.handle))
        return true;

    size_t remain = entry.serializedSize;
    const uint8_t* cursor = entry.memory;


            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 369 Column: 32 CWE codes: 126

                      const char* p = asmJSFuncNames[funcIndex].get();
        if (!p)
            return true;
        return name->append(p, strlen(p));
    }

    AsmJSMetadataCacheablePod& pod() { return *this; }
    const AsmJSMetadataCacheablePod& pod() const { return *this; }


            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 1696 Column: 43 CWE codes: 126

              
    // Helpers:
    bool addStandardLibraryMathName(const char* name, AsmJSMathBuiltinFunction func) {
        JSAtom* atom = Atomize(cx_, name, strlen(name));
        if (!atom)
            return false;
        MathBuiltin builtin(func);
        return standardLibraryMathNames_.putNew(atom->asPropertyName(), builtin);
    }

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 1703 Column: 43 CWE codes: 126

                      return standardLibraryMathNames_.putNew(atom->asPropertyName(), builtin);
    }
    bool addStandardLibraryMathName(const char* name, double cst) {
        JSAtom* atom = Atomize(cx_, name, strlen(name));
        if (!atom)
            return false;
        MathBuiltin builtin(cst);
        return standardLibraryMathNames_.putNew(atom->asPropertyName(), builtin);
    }

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 1710 Column: 43 CWE codes: 126

                      return standardLibraryMathNames_.putNew(atom->asPropertyName(), builtin);
    }
    bool addStandardLibraryAtomicsName(const char* name, AsmJSAtomicsBuiltinFunction func) {
        JSAtom* atom = Atomize(cx_, name, strlen(name));
        if (!atom)
            return false;
        return standardLibraryAtomicsNames_.putNew(atom->asPropertyName(), func);
    }
    bool addStandardLibrarySimdOpName(const char* name, SimdOperation op) {

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 1716 Column: 43 CWE codes: 126

                      return standardLibraryAtomicsNames_.putNew(atom->asPropertyName(), func);
    }
    bool addStandardLibrarySimdOpName(const char* name, SimdOperation op) {
        JSAtom* atom = Atomize(cx_, name, strlen(name));
        if (!atom)
            return false;
        return standardLibrarySimdOpNames_.putNew(atom->asPropertyName(), op);
    }
    bool newSig(Sig&& sig, uint32_t* sigIndex) {

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 7573 Column: 59 CWE codes: 126

              static bool
GetDataProperty(JSContext* cx, HandleValue objVal, const char* fieldChars, MutableHandleValue v)
{
    RootedAtom field(cx, AtomizeUTF8Chars(cx, fieldChars, strlen(fieldChars)));
    if (!field)
        return false;

    return GetDataProperty(cx, objVal, field, v);
}

            

Reported by FlawFinder.

buildscripts/lldb/lldb_printers.py
10 issues
Unable to import 'lldb'
Error

Line: 17 Column: 1

              import sys
import uuid

import lldb

try:
    import bson
    import collections
    from bson import json_util

            

Reported by Pylint.

Unused import string
Error

Line: 12 Column: 1

              """
from __future__ import print_function

import string
import struct
import sys
import uuid

import lldb

            

Reported by Pylint.

Unused import collections
Error

Line: 21 Column: 5

              
try:
    import bson
    import collections
    from bson import json_util
    from bson.codec_options import CodecOptions
except ImportError:
    print("Warning: Could not load bson library for Python {}.".format(sys.version))
    print("Check with the pip command if pymongo 3.x is installed.")

            

Reported by Pylint.

Unused CodecOptions imported from bson.codec_options
Error

Line: 23 Column: 5

                  import bson
    import collections
    from bson import json_util
    from bson.codec_options import CodecOptions
except ImportError:
    print("Warning: Could not load bson library for Python {}.".format(sys.version))
    print("Check with the pip command if pymongo 3.x is installed.")
    bson = None


            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 150 Column: 9

              
    def update(self):  # pylint: disable=no-self-use,no-method-argument
        """Match LLDB's expected API."""
        pass


class OptionalPrinter:
    """Pretty printer for boost::optional."""


            

Reported by Pylint.

Line too long (101/100)
Error

Line: 45 Column: 1

                      "type synthetic add -x '^boost::optional<.+>$' --python-class lldb_printers.OptionalPrinter"
    )
    debugger.HandleCommand(
        "type synthetic add -x '^std::unique_ptr<.+>$' --python-class lldb_printers.UniquePtrPrinter"
    )


#############################
# Pretty Printer Defintions #

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 128 Column: 9

              
    def get_child_index(self, name):  # pylint: disable=no-self-use,no-method-argument
        """Match LLDB's expected API."""
        if name == "ptr":
            return 0
        else:
            return None

    def get_child_at_index(self, index):  # pylint: disable=no-self-use,no-method-argument

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 138 Column: 9

              
        Always prints object pointed at by the ptr.
        """
        if index == 0:
            return self.valobj.GetChildMemberWithName("__ptr_").GetChildMemberWithName(
                "__value_").Dereference()
        else:
            return None


            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 167 Column: 9

              
    def get_child_index(self, name):  # pylint: disable=no-self-use,no-method-argument
        """Match LLDB's expected API."""
        if name == "value":
            return 0
        else:
            return None

    def get_child_at_index(self, index):  # pylint: disable=no-self-use,no-method-argument

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 174 Column: 9

              
    def get_child_at_index(self, index):  # pylint: disable=no-self-use,no-method-argument
        """Match LLDB's expected API."""
        if index == 0:
            return self.value
        else:
            return None

    def has_children():  # pylint: disable=no-self-use,no-method-argument

            

Reported by Pylint.

jstests/noPassthrough/libs/configExpand/rest_server.py
10 issues
Unused import json
Error

Line: 6 Column: 1

              
import argparse
import http.server
import json
import logging
import time
import urllib.parse

connect_count = 0

            

Reported by Pylint.

Using the global statement
Error

Line: 22 Column: 9

                  protocol_version = 'HTTP/1.1'

    def handle(self):
        global connect_count
        connect_count += 1
        super(ConfigExpandRestHandler, self).handle()

    def do_GET(self):
        """Serve a Test GET request."""

            

Reported by Pylint.

Using the global statement
Error

Line: 50 Column: 17

                              response = query['yaml'][0].encode()
                content_type = 'text/yaml'
            elif path == '/connect_count':
                global connect_count
                response = str(connect_count).encode()
            elif path == '/connection_close':
                connection = 'close'
                response = b'closed'
            else:

            

Reported by Pylint.

Constant name "connect_count" doesn't conform to UPPER_CASE naming style
Error

Line: 11 Column: 1

              import time
import urllib.parse

connect_count = 0


class ConfigExpandRestHandler(http.server.BaseHTTPRequestHandler):
    """
    Handle requests from mongod during config expansion.

            

Reported by Pylint.

Constant name "connect_count" doesn't conform to UPPER_CASE naming style
Error

Line: 22 Column: 9

                  protocol_version = 'HTTP/1.1'

    def handle(self):
        global connect_count
        connect_count += 1
        super(ConfigExpandRestHandler, self).handle()

    def do_GET(self):
        """Serve a Test GET request."""

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 24 Column: 9

                  def handle(self):
        global connect_count
        connect_count += 1
        super(ConfigExpandRestHandler, self).handle()

    def do_GET(self):
        """Serve a Test GET request."""
        parts = urllib.parse.urlsplit(self.path)
        path = parts.path

            

Reported by Pylint.

Method name "do_GET" doesn't conform to snake_case naming style
Error

Line: 26 Column: 5

                      connect_count += 1
        super(ConfigExpandRestHandler, self).handle()

    def do_GET(self):
        """Serve a Test GET request."""
        parts = urllib.parse.urlsplit(self.path)
        path = parts.path
        query = urllib.parse.parse_qs(parts.query)


            

Reported by Pylint.

Constant name "connect_count" doesn't conform to UPPER_CASE naming style
Error

Line: 50 Column: 17

                              response = query['yaml'][0].encode()
                content_type = 'text/yaml'
            elif path == '/connect_count':
                global connect_count
                response = str(connect_count).encode()
            elif path == '/connection_close':
                connection = 'close'
                response = b'closed'
            else:

            

Reported by Pylint.

Method name "do_POST" doesn't conform to snake_case naming style
Error

Line: 71 Column: 5

                          if sleep == 0:
                raise err

    def do_POST(self):
        self.send_response(http.HTTPStatus.NOT_FOUND)
        self.send_header('content-type', 'text/plain')
        self.end_headers()
        self.wfile.write('POST not supported')


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 71 Column: 5

                          if sleep == 0:
                raise err

    def do_POST(self):
        self.send_response(http.HTTPStatus.NOT_FOUND)
        self.send_header('content-type', 'text/plain')
        self.end_headers()
        self.wfile.write('POST not supported')


            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_hs22.py
10 issues
Unable to import 'wiredtiger'
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtscenario import make_scenarios

# test_hs22.py
# Test the case that out of order timestamp
# update is followed by a tombstone.

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtscenario import make_scenarios

# test_hs22.py
# Test the case that out of order timestamp
# update is followed by a tombstone.

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtscenario import make_scenarios

# test_hs22.py
# Test the case that out of order timestamp
# update is followed by a tombstone.

            

Reported by Pylint.

Class name "test_hs22" doesn't conform to PascalCase naming style
Error

Line: 35 Column: 1

              # test_hs22.py
# Test the case that out of order timestamp
# update is followed by a tombstone.
class test_hs22(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB'
    session_config = 'isolation=snapshot'

    key_format_values = [
        ('column', dict(key_format='r', key1=1, key2=2)),

            

Reported by Pylint.

Missing class docstring
Error

Line: 35 Column: 1

              # test_hs22.py
# Test the case that out of order timestamp
# update is followed by a tombstone.
class test_hs22(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB'
    session_config = 'isolation=snapshot'

    key_format_values = [
        ('column', dict(key_format='r', key1=1, key2=2)),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 46 Column: 5

              
    scenarios = make_scenarios(key_format_values)

    def test_onpage_out_of_order_timestamp_update(self):
        uri = 'table:test_hs22'
        self.session.create(uri, 'key_format={},value_format=S'.format(self.key_format))
        cursor = self.session.open_cursor(uri)
        self.conn.set_timestamp(
            'oldest_timestamp=' + self.timestamp_str(1) + ',stable_timestamp=' + self.timestamp_str(1))

            

Reported by Pylint.

Line too long (103/100)
Error

Line: 51 Column: 1

                      self.session.create(uri, 'key_format={},value_format=S'.format(self.key_format))
        cursor = self.session.open_cursor(uri)
        self.conn.set_timestamp(
            'oldest_timestamp=' + self.timestamp_str(1) + ',stable_timestamp=' + self.timestamp_str(1))

        key1 = self.key1
        key2 = self.key2

        value1 = 'a'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 104 Column: 5

                      self.assertEqual(cursor[key1], value2)
        self.session.rollback_transaction()

    def test_out_of_order_timestamp_update_newer_than_tombstone(self):
        uri = 'table:test_hs22'
        self.session.create(uri, 'key_format={},value_format=S'.format(self.key_format))
        cursor = self.session.open_cursor(uri)
        self.conn.set_timestamp(
            'oldest_timestamp=' + self.timestamp_str(1) + ',stable_timestamp=' + self.timestamp_str(1))

            

Reported by Pylint.

Line too long (103/100)
Error

Line: 109 Column: 1

                      self.session.create(uri, 'key_format={},value_format=S'.format(self.key_format))
        cursor = self.session.open_cursor(uri)
        self.conn.set_timestamp(
            'oldest_timestamp=' + self.timestamp_str(1) + ',stable_timestamp=' + self.timestamp_str(1))

        key1 = self.key1
        key2 = self.key2

        value1 = 'a'

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_rollback_to_stable06.py
10 issues
Unable to import 'wiredtiger'
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from test_rollback_to_stable01 import test_rollback_to_stable_base

# test_rollback_to_stable06.py

            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 57 Column: 5

              
    scenarios = make_scenarios(key_format_values, in_memory_values, prepare_values)

    def conn_config(self):
        config = 'cache_size=50MB,statistics=(all)'
        if self.in_memory:
            config += ',in_memory=true'
        else:
            config += ',log=(enabled),in_memory=false'

            

Reported by Pylint.

Undefined variable 'wttest'
Error

Line: 126 Column: 5

                          self.assertGreaterEqual(upd_aborted + hs_removed + keys_removed, nrows * 4)

if __name__ == '__main__':
    wttest.run()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled

            

Reported by Pylint.

Class name "test_rollback_to_stable06" doesn't conform to PascalCase naming style
Error

Line: 37 Column: 1

              # test_rollback_to_stable06.py
# Test that rollback to stable removes all keys when the stable timestamp is earlier than
# all commit timestamps.
class test_rollback_to_stable06(test_rollback_to_stable_base):
    session_config = 'isolation=snapshot'

    key_format_values = [
        ('column', dict(key_format='r')),
        ('integer_row', dict(key_format='i')),

            

Reported by Pylint.

Missing class docstring
Error

Line: 37 Column: 1

              # test_rollback_to_stable06.py
# Test that rollback to stable removes all keys when the stable timestamp is earlier than
# all commit timestamps.
class test_rollback_to_stable06(test_rollback_to_stable_base):
    session_config = 'isolation=snapshot'

    key_format_values = [
        ('column', dict(key_format='r')),
        ('integer_row', dict(key_format='i')),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 57 Column: 5

              
    scenarios = make_scenarios(key_format_values, in_memory_values, prepare_values)

    def conn_config(self):
        config = 'cache_size=50MB,statistics=(all)'
        if self.in_memory:
            config += ',in_memory=true'
        else:
            config += ',log=(enabled),in_memory=false'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 65 Column: 5

                          config += ',log=(enabled),in_memory=false'
        return config

    def test_rollback_to_stable(self):
        nrows = 1000

        # Create a table without logging.
        uri = "table:rollback_to_stable06"
        ds = SimpleDataSet(

            

Reported by Pylint.

Variable name "ds" doesn't conform to snake_case naming style
Error

Line: 70 Column: 9

              
        # Create a table without logging.
        uri = "table:rollback_to_stable06"
        ds = SimpleDataSet(
            self, uri, 0, key_format=self.key_format, value_format="S", config='log=(enabled=false)')
        ds.populate()

        # Pin oldest and stable to timestamp 10.
        self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(10) +

            

Reported by Pylint.

Line too long (101/100)
Error

Line: 71 Column: 1

                      # Create a table without logging.
        uri = "table:rollback_to_stable06"
        ds = SimpleDataSet(
            self, uri, 0, key_format=self.key_format, value_format="S", config='log=(enabled=false)')
        ds.populate()

        # Pin oldest and stable to timestamp 10.
        self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(10) +
            ',stable_timestamp=' + self.timestamp_str(10))

            

Reported by Pylint.

src/third_party/mozjs-60/extract/js/src/jsfriendapi.cpp
10 issues
Syntax Error: AST broken, 'for' doesn't have two operands.
Error

Line: 1107

                  bool initializedAny = false;
    NativeObject* nobj = &obj->as<NativeObject>();

    for (Shape::Range<NoGC> r(nobj->lastProperty()); !r.empty(); r.popFront()) {
        Shape* s = &r.front();
        Value v = nobj->getSlot(s->slot());
        if (s->isDataProperty() && v.isMagic() && v.whyMagic() == JS_UNINITIALIZED_LEXICAL) {
            nobj->setSlot(s->slot(), UndefinedValue());
            initializedAny = true;

            

Reported by Cppcheck.

getenv - Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once
Security

Line: 1123 Column: 38 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

              JS::IsGCPoisoning()
{
#ifdef JS_GC_POISONING
    static bool disablePoison = bool(getenv("JSGC_DISABLE_POISONING"));
    return !disablePoison;
#else
    return false;
#endif
}

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 1176 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              static void
DumpHeapVisitCompartment(JSContext* cx, void* data, JSCompartment* comp)
{
    char name[1024];
    if (cx->runtime()->compartmentNameCallback)
        (*cx->runtime()->compartmentNameCallback)(cx, comp, name, sizeof(name));
    else
        strcpy(name, "<unknown>");


            

Reported by FlawFinder.

strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 1180 Column: 9 CWE codes: 120
Suggestion: Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)

                  if (cx->runtime()->compartmentNameCallback)
        (*cx->runtime()->compartmentNameCallback)(cx, comp, name, sizeof(name));
    else
        strcpy(name, "<unknown>");

    DumpHeapTracer* dtrc = static_cast<DumpHeapTracer*>(data);
    fprintf(dtrc->output, "# compartment %s [in zone %p]\n", name, (void*)comp->zone());
}


            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 1200 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                                JS::TraceKind traceKind, size_t thingSize)
{
    DumpHeapTracer* dtrc = static_cast<DumpHeapTracer*>(data);
    char cellDesc[1024 * 32];
    JS_GetTraceThingInfo(cellDesc, sizeof(cellDesc), dtrc, thing, traceKind, true);
    fprintf(dtrc->output, "%p %c %s\n", thing, MarkDescriptor(thing), cellDesc);
    js::TraceChildren(dtrc, thing, traceKind);
}


            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 1212 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                  if (gc::IsInsideNursery(thing.asCell()))
        return;

    char buffer[1024];
    getTracingEdgeName(buffer, sizeof(buffer));
    fprintf(output, "%s%p %c %s\n", prefix, thing.asCell(), MarkDescriptor(thing.asCell()), buffer);
}

void

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 235 Column: 44 CWE codes: 126

              static bool
DefineHelpProperty(JSContext* cx, HandleObject obj, const char* prop, const char* value)
{
    RootedAtom atom(cx, Atomize(cx, value, strlen(value)));
    if (!atom)
        return false;
    return JS_DefineProperty(cx, obj, prop, atom, JSPROP_READONLY | JSPROP_PERMANENT);
}


            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 249 Column: 46 CWE codes: 126

                  CHECK_REQUEST(cx);
    assertSameCompartment(cx, obj);
    for (; fs->name; fs++) {
        JSAtom* atom = Atomize(cx, fs->name, strlen(fs->name));
        if (!atom)
            return false;

        Rooted<jsid> id(cx, AtomToId(atom));
        RootedFunction fun(cx, DefineFunction(cx, obj, id, fs->call, fs->nargs,

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 430 Column: 38 CWE codes: 126

                  MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment()));
    CHECK_REQUEST(cx);
    assertSameCompartment(cx, obj);
    JSAtom* atom = Atomize(cx, name, strlen(name));
    if (!atom)
        return nullptr;
    Rooted<jsid> id(cx, AtomToId(atom));
    return DefineFunction(cx, obj, id, call, nargs, attrs, gc::AllocKind::FUNCTION_EXTENDED);
}

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 447 Column: 34 CWE codes: 126

              
    RootedAtom atom(cx);
    if (name) {
        atom = Atomize(cx, name, strlen(name));
        if (!atom)
            return nullptr;
    }

    return (flags & JSFUN_CONSTRUCTOR) ?

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_hs16.py
10 issues
Unable to import 'wiredtiger'
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import time, wiredtiger, wttest
from wtscenario import make_scenarios

# test_hs16.py
# Ensure that we don't panic when inserting an update without timestamp to the history store.
class test_hs16(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import time
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import time, wiredtiger, wttest
from wtscenario import make_scenarios

# test_hs16.py
# Ensure that we don't panic when inserting an update without timestamp to the history store.
class test_hs16(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import time, wiredtiger, wttest
from wtscenario import make_scenarios

# test_hs16.py
# Ensure that we don't panic when inserting an update without timestamp to the history store.
class test_hs16(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused variable 'cursor2'
Error

Line: 66 Column: 9

              
        # Open anther session to make the next update without timestamp non-globally visible
        session2 = self.setUpSessionOpen(self.conn)
        cursor2 = session2.open_cursor(uri)
        session2.begin_transaction()
        cursor[self.create_key(2)] = 'a'

        # Update an update without timestamp
        self.session.begin_transaction()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled

            

Reported by Pylint.

Multiple imports on one line (time, wiredtiger, wttest)
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import time, wiredtiger, wttest
from wtscenario import make_scenarios

# test_hs16.py
# Ensure that we don't panic when inserting an update without timestamp to the history store.
class test_hs16(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Missing class docstring
Error

Line: 34 Column: 1

              
# test_hs16.py
# Ensure that we don't panic when inserting an update without timestamp to the history store.
class test_hs16(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=5MB'
    session_config = 'isolation=snapshot'
    key_format_values = (
        ('column', dict(key_format='r')),
        ('string-row', dict(key_format='S'))

            

Reported by Pylint.

Class name "test_hs16" doesn't conform to PascalCase naming style
Error

Line: 34 Column: 1

              
# test_hs16.py
# Ensure that we don't panic when inserting an update without timestamp to the history store.
class test_hs16(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=5MB'
    session_config = 'isolation=snapshot'
    key_format_values = (
        ('column', dict(key_format='r')),
        ('string-row', dict(key_format='S'))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 43 Column: 5

                  )
    scenarios = make_scenarios(key_format_values)

    def create_key(self,i):
        if self.key_format == 'S':
            return str(i)
        return i

    def test_hs16(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 48 Column: 5

                          return str(i)
        return i

    def test_hs16(self):
        uri = 'table:test_hs16'
        create_params = 'key_format={}, value_format=S'.format(self.key_format)
        self.session.create(uri, create_params)
        cursor = self.session.open_cursor(uri)


            

Reported by Pylint.