tlsfuzzer/tlslite-ng

View on GitHub

Showing 324 of 1,708 total issues

Function _serverSendTickets has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def _serverSendTickets(self, settings):
        """Send session tickets to client."""
        if not settings.ticketKeys:
            return

Severity: Minor
Found in tlslite/tlsconnection.py - About 2 hrs 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 _tryDecrypt has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def _tryDecrypt(self, settings, identity=None, ticket=None):
        if not settings.ticketKeys:
            return None, None

        if self.version < (3, 4):
Severity: Minor
Found in tlslite/tlsconnection.py - About 2 hrs 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

HandshakeSettings has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class HandshakeSettings(object):
    """
    This class encapsulates various parameters that can be used with
    a TLS handshake.

Severity: Minor
Found in tlslite/handshakesettings.py - About 2 hrs to fix

    Function deprecated_instance_attrs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def deprecated_instance_attrs(names,
                                  warn="Attribute '{old_name}' is deprecated, "
                                       "please use '{new_name}'"):
        """Decorator to deprecate class instance attributes.
    
    
    Severity: Minor
    Found in tlslite/utils/deprecations.py - About 2 hrs 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 _sendMsgThroughSocket has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def _sendMsgThroughSocket(self, msg):
            """Send message, handle errors"""
    
            try:
                for result in self._recordLayer.sendRecord(msg):
    Severity: Minor
    Found in tlslite/tlsrecordlayer.py - About 2 hrs 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 create has 19 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def create(self, masterSecret, sessionID, cipherSuite,
    Severity: Major
    Found in tlslite/session.py - About 2 hrs to fix

      Function _clientTLS13Handshake has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _clientTLS13Handshake(self, settings, session, clientHello,
                                    clientCertChain, privateKey, serverHello):
              """Perform TLS 1.3 handshake as a client."""
              prfName, prf_size = self._getPRFParams(serverHello.cipher_suite)
      
      
      Severity: Major
      Found in tlslite/tlsconnection.py - About 2 hrs to fix

        Function brotli_build_huffman_table has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        def brotli_build_huffman_table(
                root_table, table, root_bits, code_lengths, code_lengths_size):
            start_table = table
            # Local variables used
            # code             current table entry
        Severity: Minor
        Found in tlslite/utils/brotlidecpy/huffman.py - About 2 hrs 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 _decompress has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def _decompress(self, compressed_msg, expected_length):
                if not (
                    (self.compression_algo == CertificateCompressionAlgorithm.zlib) or
                    (self.compression_algo == CertificateCompressionAlgorithm.brotli
                     and compression_algo_impls["brotli_decompress"]) or
        Severity: Minor
        Found in tlslite/messages.py - About 2 hrs 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 recvMessage has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def recvMessage(self):
                """
                Read next message in queue
        
                will return a 0 or 1 if the read is blocking, a tuple of
        Severity: Minor
        Found in tlslite/messagesocket.py - About 2 hrs 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 isPrime has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        def isPrime(n, iterations=5, display=False, sieve=makeSieve(1000)):
            #Trial division with sieve
            for x in sieve:
                if x >= n: return True
                if n % x == 0: return False
        Severity: Minor
        Found in tlslite/utils/cryptomath.py - About 2 hrs 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 makeCertificateVerify has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def makeCertificateVerify(version, handshakeHashes, validSigAlgs,
                                      privateKey, certificateRequest, premasterSecret,
                                      clientRandom, serverRandom):
                """Create a Certificate Verify message
        
        
        Severity: Minor
        Found in tlslite/keyexchange.py - About 2 hrs 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

        Consider simplifying this complex logical expression.
        Open

                if username and password and not \
                        (certChain or privateKey):
                    self.username = username
                    self.password = password
        
        
        Severity: Critical
        Found in tlslite/integration/clienthelper.py - About 2 hrs to fix

          Function __init__ has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self,
                           username=None, password=None,
                           certChain=None, privateKey=None,
                           checker=None,
                           settings=None,
          Severity: Minor
          Found in tlslite/integration/clienthelper.py - About 1 hr 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 deprecated_class_name has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          def deprecated_class_name(old_name,
                                    warn="Class name '{old_name}' is deprecated, "
                                    "please use '{new_name}'"):
              """
              Class decorator to deprecate a use of class.
          Severity: Minor
          Found in tlslite/utils/deprecations.py - About 1 hr 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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, n=0, e=0, d=0, p=0, q=0, dP=0, dQ=0, qInv=0,
                           key_type="rsa"):
                  """Initialise key directly from integers.
          
                  see also generate() and parsePEM()."""
          Severity: Minor
          Found in tlslite/utils/python_rsakey.py - About 1 hr 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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, context_map_size, br):
                  max_run_length_prefix = 0
                  self.num_huff_trees = decode_var_len_uint8(br) + 1
                  self.context_map = bytearray([0] * context_map_size)
          
          
          Severity: Minor
          Found in tlslite/utils/brotlidecpy/decode.py - About 1 hr 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 _handshakeWrapperAsync has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def _handshakeWrapperAsync(self, handshaker, checker):
                  try:
                      for result in handshaker:
                          yield result
                      if checker:
          Severity: Minor
          Found in tlslite/tlsconnection.py - About 1 hr 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 signServerKeyExchange has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def signServerKeyExchange(self, serverKeyExchange, sigHash=None):
                  """
                  Sign a server key exchange using default or specified algorithm
          
                  :type sigHash: str
          Severity: Minor
          Found in tlslite/keyexchange.py - About 1 hr 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 calcFinished has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          def calcFinished(version, masterSecret, cipherSuite, handshakeHashes,
                           isClient):
              """Calculate the Handshake protocol Finished value
          
              :param version: TLS protocol version tuple
          Severity: Minor
          Found in tlslite/mathtls.py - About 1 hr 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