tlsfuzzer/tlslite-ng

View on GitHub

Showing 1,708 of 1,708 total issues

Function calcSSL2PendingStates has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def calcSSL2PendingStates(self, cipherSuite, masterSecret, clientRandom,
                              serverRandom, implementations):
        """
        Create the keys for encryption and decryption in SSLv2

Severity: Minor
Found in tlslite/recordlayer.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 paramStrength has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def paramStrength(param):
    """
    Return level of security for DH, DSA and RSA parameters.

    Provide the approximate level of security for algorithms based on finite
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

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

    for implementation in implementations:
        if implementation == "openssl" and cryptomath.m2cryptoLoaded:
            return OpenSSL_RSAKey.generate(bits)
        elif implementation == "python":
            return Python_RSAKey.generate(bits)
Severity: Major
Found in tlslite/utils/keyfactory.py and 1 other location - About 1 hr to fix
tlslite/utils/cipherfactory.py on lines 179..184

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 46.

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 2 locations. Consider refactoring.
Open

        if impl == "openssl" and cryptomath.m2cryptoLoaded:
            return openssl_rc4.new(key)
        elif impl == "pycrypto" and cryptomath.pycryptoLoaded:
            return pycrypto_rc4.new(key)
        elif impl == "python":
Severity: Major
Found in tlslite/utils/cipherfactory.py and 1 other location - About 1 hr to fix
tlslite/utils/keyfactory.py on lines 34..38

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 46.

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 2 locations. Consider refactoring.
Open

        while suffix_pos < len(suffix):
            dst[idx] = suffix[suffix_pos]
            idx += 1
            suffix_pos += 1
Severity: Major
Found in tlslite/utils/brotlidecpy/transform.py and 1 other location - About 1 hr to fix
tlslite/utils/brotlidecpy/transform.py on lines 29..32

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 45.

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 2 locations. Consider refactoring.
Open

        while prefix_pos < len(prefix):
            dst[idx] = prefix[prefix_pos]
            idx += 1
            prefix_pos += 1
Severity: Major
Found in tlslite/utils/brotlidecpy/transform.py and 1 other location - About 1 hr to fix
tlslite/utils/brotlidecpy/transform.py on lines 55..58

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 45.

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

Function __init__ has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self, sock):
        sock = BufferedSocket(sock)
        self.sock = sock
        self._recordLayer = RecordLayer(sock)

Severity: Minor
Found in tlslite/tlsrecordlayer.py - About 1 hr to fix

    Function choose_compression_send_algo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def choose_compression_send_algo(version, extension, valid_algos):
        if not extension or not version or version < (3, 4):
            return None
    
        chosen_compression_algo = None
    Severity: Minor
    Found in tlslite/utils/compression.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 verify has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify(self, sigBytes, bytes, padding='pkcs1', hashAlg=None,
                   saltLen=None):
            """Verify the passed-in bytes with the signature.
    
            This verifies a PKCS1 signature on the passed-in data.
    Severity: Minor
    Found in tlslite/utils/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 _createPrivateRSAKey has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _createPrivateRSAKey(n, e, d, p, q, dP, dQ, qInv, key_type,
    Severity: Major
    Found in tlslite/utils/keyfactory.py - About 1 hr to fix

      Function hash has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def hash(self, clientRandom, serverRandom):
              """
              Calculate hash of parameters to sign.
      
              :rtype: bytearray
      Severity: Minor
      Found in tlslite/messages.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 create has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def create(self, version, random, session_id, cipher_suites,
      Severity: Major
      Found in tlslite/messages.py - About 1 hr to fix

        Function handshakeClientCert has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def handshakeClientCert(self, certChain=None, privateKey=None,
        Severity: Major
        Found in tlslite/tlsconnection.py - About 1 hr to fix

          Function _clientSendClientHello has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _clientSendClientHello(self, settings, session, srpUsername,
          Severity: Major
          Found in tlslite/tlsconnection.py - About 1 hr to fix

            Function parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def parse(self, parser):
                    """
                    Deserialise the message from :py:class:`Parser`,
            
                    returns self
            Severity: Minor
            Found in tlslite/messages.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 keyingMaterialExporter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def keyingMaterialExporter(self, label, length=20):
                    """Return keying material as described in RFC 5705
            
                    :type label: bytearray
                    :param label: label to be provided for the exporter
            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 _serverAnonKeyExchange has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def _serverAnonKeyExchange(self, serverHello, keyExchange, cipherSuite):
            
                    # Create ServerKeyExchange
                    serverKeyExchange = keyExchange.makeServerKeyExchange()
            
            
            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 _handshakeClientAsync has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _handshakeClientAsync(self, srpParams=(), certParams=(), anonParams=(),
            Severity: Major
            Found in tlslite/tlsconnection.py - About 1 hr to fix

              Function parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse(self, p):
                      """Deserialise object from on the wire data."""
                      if self.ssl2:
                          self.client_version = (p.get(1), p.get(1))
                          cipherSpecsLength = p.get(2)
              Severity: Minor
              Found in tlslite/messages.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

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

                  def a2b_hex(s):
                      try:
                          b = bytearray(binascii.a2b_hex(s))
                      except Exception as e:
                          raise SyntaxError("base16 error: %s" % e)
              Severity: Major
              Found in tlslite/utils/compat.py and 1 other location - About 1 hr to fix
              tlslite/utils/compat.py on lines 166..171

              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 44.

              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