tlsfuzzer/tlslite-ng

View on GitHub

Showing 1,708 of 1,708 total issues

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

                    Avoid deeply nested control flow statements.
                    Open

                                            for i, ext in enumerate(clientHello.extensions):
                                                if ext.extType == \
                                                        ExtensionType.client_hello_padding:
                                                    clientHello1.extensions.insert(i, ext)
                                                    break
                    Severity: Major
                    Found in tlslite/tlsconnection.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              for result in self._sendError(AlertDescription
                                                                            .handshake_failure,
                                                                            "No acceptable group "
                                                                            "advertised by client"):
                                                  yield result
                      Severity: Major
                      Found in tlslite/tlsconnection.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                for result in self._sendError(
                                                        AlertDescription.illegal_parameter,
                                                        "PSK extension not last in client hello"):
                                                    yield result
                                        # early_data extension MUST be dropped
                        Severity: Major
                        Found in tlslite/tlsconnection.py - About 45 mins to fix

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

                              def write(self):
                                  """Serialise object to bytearray."""
                                  writer = Writer()
                          
                                  shortHeader = not (self.padding or self.securityEscape)
                          Severity: Minor
                          Found in tlslite/messages.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

                          Severity
                          Category
                          Status
                          Source
                          Language