tlsfuzzer/tlslite-ng

View on GitHub

Showing 1,732 of 1,732 total issues

Function _serverGetClientHello has a Cognitive Complexity of 595 (exceeds 5 allowed). Consider refactoring.
Open

    def _serverGetClientHello(self, settings, private_key, cert_chain,
                              verifierDB,
                              sessionCache, anon, alpn, sni):
        # Tentatively set version to most-desirable version, so if an error
        # occurs parsing the ClientHello, this will be the version we'll use
Severity: Minor
Found in tlslite/tlsconnection.py - About 1 wk 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

File tlsconnection.py has 4026 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Authors:
#   Trevor Perrin
#   Google - added reqCAs parameter
#   Google (adapted by Sam Rushing and Marcelo Fernandez) - NPN support
#   Google - FALLBACK_SCSV
Severity: Major
Found in tlslite/tlsconnection.py - About 1 wk to fix

    File messages.py has 2125 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # Authors:
    #   Trevor Perrin
    #   Google - handling CertificateRequest.certificate_types
    #   Google (adapted by Sam Rushing and Marcelo Fernandez) - NPN support
    #   Dimitris Moraitis - Anon ciphersuites
    Severity: Major
    Found in tlslite/messages.py - About 5 days to fix

      Cyclomatic complexity is too high in method _serverGetClientHello. (267)
      Open

          def _serverGetClientHello(self, settings, private_key, cert_chain,
                                    verifierDB,
                                    sessionCache, anon, alpn, sni):
              # Tentatively set version to most-desirable version, so if an error
              # occurs parsing the ClientHello, this will be the version we'll use
      Severity: Minor
      Found in tlslite/tlsconnection.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      File extensions.py has 1694 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright (c) 2014, 2015 Hubert Kario
      #
      # See the LICENSE file for legal information regarding use of this file.
      
      """ Helper package for handling TLS extensions encountered in ClientHello
      Severity: Major
      Found in tlslite/extensions.py - About 4 days to fix

        Function _getMsg has a Cognitive Complexity of 182 (exceeds 5 allowed). Consider refactoring.
        Open

            def _getMsg(self, expectedType, secondaryType=None, constructorType=None):
                try:
                    if not isinstance(expectedType, tuple):
                        expectedType = (expectedType,)
        
        
        Severity: Minor
        Found in tlslite/tlsrecordlayer.py - About 3 days 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

        File constants.py has 1358 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Authors:
        #   Trevor Perrin
        #   Google - defining ClientCertificateType
        #   Google (adapted by Sam Rushing) - NPN support
        #   Dimitris Moraitis - Anon ciphersuites
        Severity: Major
        Found in tlslite/constants.py - About 3 days to fix

          Function _serverTLS13Handshake has a Cognitive Complexity of 151 (exceeds 5 allowed). Consider refactoring.
          Open

              def _serverTLS13Handshake(self, settings, clientHello, cipherSuite,
                                        privateKey, serverCertChain, version, scheme,
                                        srv_alpns, reqCert):
                  """Perform a TLS 1.3 handshake"""
                  prf_name, prf_size = self._getPRFParams(cipherSuite)
          Severity: Minor
          Found in tlslite/tlsconnection.py - About 3 days 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

          File tlsrecordlayer.py has 1163 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Authors:
          #   Trevor Perrin
          #   Google (adapted by Sam Rushing) - NPN support
          #   Google - minimal padding
          #   Martin von Loewis - python 3 port
          Severity: Major
          Found in tlslite/tlsrecordlayer.py - About 2 days to fix

            Function _clientTLS13Handshake has a Cognitive Complexity of 143 (exceeds 5 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: Minor
            Found in tlslite/tlsconnection.py - About 2 days 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 _clientGetServerHello has a Cognitive Complexity of 141 (exceeds 5 allowed). Consider refactoring.
            Open

                def _clientGetServerHello(self, settings, session, clientHello):
                    client_hello_hash = self._handshake_hash.copy()
                    for result in self._getMsg(ContentType.handshake,
                                               HandshakeType.server_hello):
                        if result in (0,1): yield result
            Severity: Minor
            Found in tlslite/tlsconnection.py - About 2 days 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 _handshakeServerAsyncHelper has a Cognitive Complexity of 132 (exceeds 5 allowed). Consider refactoring.
            Open

                def _handshakeServerAsyncHelper(self, verifierDB,
                                                cert_chain, privateKey, reqCert,
                                                sessionCache, settings, reqCAs, tacks,
                                                activationFlags, nextProtos, anon, alpn,
                                                sni):
            Severity: Minor
            Found in tlslite/tlsconnection.py - About 2 days 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

            File keyexchange.py has 1053 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # Authors:
            #   Hubert Kario (2015)
            #
            # See the LICENSE file for legal information regarding use of this file.
            """Handling of cryptographic operations for key exchange"""
            Severity: Major
            Found in tlslite/keyexchange.py - About 2 days to fix

              File recordlayer.py has 1047 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # Copyright (c) 2014, Hubert Kario
              #
              # See the LICENSE file for legal information regarding use of this file.
              
              """Implementation of the TLS Record Layer protocol"""
              Severity: Major
              Found in tlslite/recordlayer.py - About 2 days to fix

                File rijndael.py has 1029 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # Authors:
                #   Bram Cohen
                #   Trevor Perrin - various changes
                #
                # See the LICENSE file for legal information regarding use of this file.
                Severity: Major
                Found in tlslite/utils/rijndael.py - About 2 days to fix

                  Function _serverCertKeyExchange has a Cognitive Complexity of 122 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _serverCertKeyExchange(self, clientHello, serverHello, sigHashAlg,
                                                  serverCertChain, keyExchange,
                                                  reqCert, reqCAs, cipherSuite,
                                                  settings):
                          #Send ServerHello, Certificate or Compressed Certificate
                  Severity: Minor
                  Found in tlslite/tlsconnection.py - About 2 days 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

                  Similar blocks of code found in 14 locations. Consider refactoring.
                  Open

                  U3 = (0x0, 0xd0b0e09, 0x1a161c12, 0x171d121b,
                        0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f,
                        0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253,
                        0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77,
                        0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b,
                  Severity: Major
                  Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
                  tlslite/utils/rijndael.py on lines 51..82
                  tlslite/utils/rijndael.py on lines 85..116
                  tlslite/utils/rijndael.py on lines 118..181
                  tlslite/utils/rijndael.py on lines 183..246
                  tlslite/utils/rijndael.py on lines 248..311
                  tlslite/utils/rijndael.py on lines 313..376
                  tlslite/utils/rijndael.py on lines 378..441
                  tlslite/utils/rijndael.py on lines 443..506
                  tlslite/utils/rijndael.py on lines 508..571
                  tlslite/utils/rijndael.py on lines 573..636
                  tlslite/utils/rijndael.py on lines 638..701
                  tlslite/utils/rijndael.py on lines 703..766
                  tlslite/utils/rijndael.py on lines 833..896

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 262.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 14 locations. Consider refactoring.
                  Open

                  U4 = (0x0, 0x90d0b0e, 0x121a161c, 0x1b171d12,
                        0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a,
                        0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562,
                        0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a,
                        0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2,
                  Severity: Major
                  Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
                  tlslite/utils/rijndael.py on lines 51..82
                  tlslite/utils/rijndael.py on lines 85..116
                  tlslite/utils/rijndael.py on lines 118..181
                  tlslite/utils/rijndael.py on lines 183..246
                  tlslite/utils/rijndael.py on lines 248..311
                  tlslite/utils/rijndael.py on lines 313..376
                  tlslite/utils/rijndael.py on lines 378..441
                  tlslite/utils/rijndael.py on lines 443..506
                  tlslite/utils/rijndael.py on lines 508..571
                  tlslite/utils/rijndael.py on lines 573..636
                  tlslite/utils/rijndael.py on lines 638..701
                  tlslite/utils/rijndael.py on lines 703..766
                  tlslite/utils/rijndael.py on lines 768..831

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 262.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 14 locations. Consider refactoring.
                  Open

                  Si = (82, 9, 106, 213, 48, 54, 165, 56,
                        191, 64, 163, 158, 129, 243, 215, 251,
                        124, 227, 57, 130, 155, 47, 255, 135,
                        52, 142, 67, 68, 196, 222, 233, 203,
                        84, 123, 148, 50, 166, 194, 35, 61,
                  Severity: Major
                  Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
                  tlslite/utils/rijndael.py on lines 51..82
                  tlslite/utils/rijndael.py on lines 118..181
                  tlslite/utils/rijndael.py on lines 183..246
                  tlslite/utils/rijndael.py on lines 248..311
                  tlslite/utils/rijndael.py on lines 313..376
                  tlslite/utils/rijndael.py on lines 378..441
                  tlslite/utils/rijndael.py on lines 443..506
                  tlslite/utils/rijndael.py on lines 508..571
                  tlslite/utils/rijndael.py on lines 573..636
                  tlslite/utils/rijndael.py on lines 638..701
                  tlslite/utils/rijndael.py on lines 703..766
                  tlslite/utils/rijndael.py on lines 768..831
                  tlslite/utils/rijndael.py on lines 833..896

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 262.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 14 locations. Consider refactoring.
                  Open

                  T7 = (0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27,
                        0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x3934be3,
                        0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502,
                        0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562,
                        0x5a49deb1, 0x1b6725ba, 0xe9845ea, 0xc0e15dfe,
                  Severity: Major
                  Found in tlslite/utils/rijndael.py and 13 other locations - About 2 days to fix
                  tlslite/utils/rijndael.py on lines 51..82
                  tlslite/utils/rijndael.py on lines 85..116
                  tlslite/utils/rijndael.py on lines 118..181
                  tlslite/utils/rijndael.py on lines 183..246
                  tlslite/utils/rijndael.py on lines 248..311
                  tlslite/utils/rijndael.py on lines 313..376
                  tlslite/utils/rijndael.py on lines 378..441
                  tlslite/utils/rijndael.py on lines 443..506
                  tlslite/utils/rijndael.py on lines 573..636
                  tlslite/utils/rijndael.py on lines 638..701
                  tlslite/utils/rijndael.py on lines 703..766
                  tlslite/utils/rijndael.py on lines 768..831
                  tlslite/utils/rijndael.py on lines 833..896

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 262.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language