tlsfuzzer/tlslite-ng

View on GitHub

Showing 1,708 of 1,708 total issues

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

    def __eq__(self, other):
        """Compare objects with each-other."""
        if not hasattr(other, "x509List"):
            return NotImplemented
        return self.x509List == other.x509List
Severity: Minor
Found in tlslite/x509certchain.py and 1 other location - About 50 mins to fix
tlslite/x509.py on lines 53..57

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

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

class RenegotiationInfoExtension(VarBytesExtension):
    """
    Client and Server Hello secure renegotiation extension from RFC 5746

    Should have an empty renegotiated_connection field in case of initial
Severity: Minor
Found in tlslite/extensions.py and 1 other location - About 50 mins to fix
tlslite/extensions.py on lines 2096..2102

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

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

    def parse(self, parser):
        """Deserialize the object from bytearray."""
        self.identity = parser.getVarBytes(2)
        self.obfuscated_ticket_age = parser.get(4)
        return self
Severity: Minor
Found in tlslite/extensions.py and 1 other location - About 50 mins to fix
tlslite/extensions.py on lines 1772..1782

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

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

    def readable(self):
        result = self.wantsReadEvent()
        if result != None:
            return result
        return self.siblingClass.readable(self)
Severity: Minor
Found in tlslite/integration/tlsasyncdispatchermixin.py and 1 other location - About 50 mins to fix
tlslite/integration/tlsasyncdispatchermixin.py on lines 107..111

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

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

    def writable(self):
        result = self.wantsWriteEvent()
        if result != None:
            return result
        return self.siblingClass.writable(self)
Severity: Minor
Found in tlslite/integration/tlsasyncdispatchermixin.py and 1 other location - About 50 mins to fix
tlslite/integration/tlsasyncdispatchermixin.py on lines 101..105

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

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

    def __eq__(self, other):
        """Compare other object for equality."""
        if not hasattr(other, "bytes"):
            return NotImplemented
        return self.bytes == other.bytes
Severity: Minor
Found in tlslite/x509.py and 1 other location - About 50 mins to fix
tlslite/x509certchain.py on lines 37..41

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

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

    def parse(self, parser):
        """
        Parse the value from on the wire format.

        :param Parser parser: data to be parsed as extension
Severity: Minor
Found in tlslite/extensions.py and 1 other location - About 50 mins to fix
tlslite/extensions.py on lines 2004..2008

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

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

class CookieExtension(VarBytesExtension):
    """Handling of the TLS 1.3 cookie extension."""

    def __init__(self):
        """Create instance."""
Severity: Minor
Found in tlslite/extensions.py and 1 other location - About 50 mins to fix
tlslite/extensions.py on lines 1503..1517

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

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 create has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def create(self, public_key, min_generation, generation, expiration,
Severity: Minor
Found in tlslite/extensions.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                    for result in self._sendMsg(alertMsg):
                                        yield result
                                except socket.error:
    Severity: Major
    Found in tlslite/tlsrecordlayer.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if subType == HandshakeType.hello_request:
                                      reneg = True
                              else:
      Severity: Major
      Found in tlslite/tlsrecordlayer.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if chain.getFingerprint() != self.x509Fingerprint:
                                    raise TLSFingerprintError(\
                                        "X.509 fingerprint mismatch: %s, %s" % \
                                        (chain.getFingerprint(), self.x509Fingerprint))
                        elif chain:
        Severity: Major
        Found in tlslite/checker.py - About 45 mins to fix

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

              def __init__(self, elemLength, elemNum, lengthLength, fieldName, extType,
          Severity: Minor
          Found in tlslite/extensions.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        for result in self._sendMsg(alertMsg):
                                            yield result
                                        continue
            Severity: Major
            Found in tlslite/tlsrecordlayer.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                              if len(heartbeat_message.padding) < 16:
                                                  # per RFC, silently ignore if the message
                                                  # is malformed
                                                  continue
                                              heartbeat_response = heartbeat_message.\
              Severity: Major
              Found in tlslite/tlsrecordlayer.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                if not self.heartbeat_can_receive:
                                                    for result in self._sendError(
                                                            AlertDescription.
                                                            unexpected_message,
                                                            "Received heartbeat_request to "
                Severity: Major
                Found in tlslite/tlsrecordlayer.py - About 45 mins to fix

                  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

                      Severity
                      Category
                      Status
                      Source
                      Language