tlsfuzzer/tlslite-ng

View on GitHub

Showing 324 of 1,708 total issues

Function verify has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def verify(self, signature, hashData, padding=None, hashAlg=None,
               saltLen=None):
        """Verify the passed-in bytes with the signature.

        This verifies a DSA signature on the passed-in data.
Severity: Minor
Found in tlslite/utils/python_dsakey.py - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid deeply nested control flow statements.
Open

                    if transform_idx < kNumTransforms:
                        length = Transform.transformDictionaryWord(
                            output_buffer, copy_dst, offset, copy_length,
                            transform_idx)
                        copy_dst += length
Severity: Major
Found in tlslite/utils/brotlidecpy/decode.py - About 45 mins to fix

    Function ct_check_cbc_mac_and_pad has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def ct_check_cbc_mac_and_pad(data, mac, seqnumBytes, contentType, version,
    Severity: Minor
    Found in tlslite/utils/constanttime.py - About 45 mins to fix

      Function int_to_bytes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def int_to_bytes(val, length=None, byteorder="big"):
              """Return number converted to bytes"""
              if length is None:
                  if val:
                      length = byte_length(val)
      Severity: Minor
      Found in tlslite/utils/compat.py - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function createDateClass has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def createDateClass(year, month, day, hour, minute, second):
      Severity: Minor
      Found in tlslite/utils/datefuncs.py - About 45 mins to fix

        Function createAESGCM has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def createAESGCM(key, implList=None):
            """Create a new AESGCM object.
        
            :type key: bytearray
            :param key: A 16 or 32 byte byte array.
        Severity: Minor
        Found in tlslite/utils/cipherfactory.py - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function read_bits has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def read_bits(self, n_bits, bits_to_skip=None):
                """
                Get n_bits unsigned integer treating input as little-endian byte
                stream, maybe advancing input buffer pointer
        
        
        Severity: Minor
        Found in tlslite/utils/brotlidecpy/bit_reader.py - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Avoid deeply nested control flow statements.
        Open

                                    if alert.description == \
                                           AlertDescription.close_notify:
                                        self._shutdown(True)
                                    elif alert.level == AlertLevel.warning:
                                        self._shutdown(False)
        Severity: Major
        Found in tlslite/tlsrecordlayer.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          for result in self._sendMsg(
                                                  heartbeat_response):
                                              yield result
                                      # If we received heartbeat response, then we
                                      # check, if its payload is same as payload of
          Severity: Major
          Found in tlslite/tlsrecordlayer.py - About 45 mins to fix

            Function _cbcmac_calc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _cbcmac_calc(self, nonce, aad, msg):
                    L = 15 - len(nonce)
                    mac_data = bytearray()
            
                    # Flags constructed as in section 2.2 in the rfc
            Severity: Minor
            Found in tlslite/utils/aesccm.py - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function createDateClass has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def createDateClass(year, month, day, hour, minute, second):
            Severity: Minor
            Found in tlslite/utils/datefuncs.py - About 45 mins to fix

              Function add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      def add(self, x, length):
                          """
                          Add a single positive integer value x, encode it in length bytes
              
                          Encode positive iteger x in big-endian format using length bytes,
              Severity: Minor
              Found in tlslite/utils/codec.py - About 45 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Avoid deeply nested control flow statements.
              Open

                                          if result in (0,1):
                                              yield result
                                      if result.contentType == ContentType.alert:
              Severity: Major
              Found in tlslite/tlsrecordlayer.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if subType == HandshakeType.client_hello:
                                                reneg = True
                                        # Send no_renegotiation if we're not negotiating
                                        # a connection now, then try again
                                        if reneg and self.session:
                Severity: Major
                Found in tlslite/tlsrecordlayer.py - About 45 mins to fix

                  Function generate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def generate(bits, key_type="rsa"):
                          """Generate a private key with modulus 'bits' bit big.
                  
                          key_type can be "rsa" for a universal rsaEncryption key or
                          "rsa-pss" for a key that can be used only for RSASSA-PSS."""
                  Severity: Minor
                  Found in tlslite/utils/python_rsakey.py - About 45 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function starttls has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def starttls(self,
                  Severity: Minor
                  Found in tlslite/integration/smtp_tls.py - About 45 mins to fix

                    Function deprecated_attrs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def deprecated_attrs(names, warn="Attribute '{old_name}' is deprecated, "
                                                     "please use '{new_name}'"):
                        """Decorator to deprecate all specified attributes in class.
                    
                        Translates all names in `names` to use new names and emits warnings
                    Severity: Minor
                    Found in tlslite/utils/deprecations.py - About 45 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function _parse_ecdsa_private_key has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _parse_ecdsa_private_key(private, curve):
                            ver = private.getChild(0)
                            if ver.value != b'\x01':
                                raise SyntaxError("Unexpected EC key version")
                            private_key = private.getChild(1)
                    Severity: Minor
                    Found in tlslite/utils/python_key.py - About 45 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(self, cipherSuite, clientHello, serverHello, privateKey,
                    Severity: Minor
                    Found in tlslite/keyexchange.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              for protocolName in alpnExt.protocol_names:
                                                  if protocolName in alpn:
                                                      ext = ALPNExtension().create([protocolName])
                                                      extensions.append(ext)
                                                      selectedALPN = protocolName
                      Severity: Major
                      Found in tlslite/tlsconnection.py - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language