thekuwayama/tttls1.3

View on GitHub

Showing 84 of 95 total issues

Method deserialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def self.deserialize(binary, cipher, buffered = '',
                           record_size_limit = DEFAULT_RECORD_SIZE_LIMIT)
        raise Error::ErrorAlerts, :internal_error if binary.nil?
        raise Error::ErrorAlerts, :decode_error if binary.length < 5

Severity: Minor
Found in lib/tttls1.3/message/record.rb - 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

Method deserialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def self.deserialize(binary, msg_type)
        raise Error::ErrorAlerts, :internal_error if binary.nil?

        exs = Extensions.new
        i = 0
Severity: Minor
Found in lib/tttls1.3/message/extensions.rb - 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

Method send_new_client_hello has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def send_new_client_hello(ch1,
                              hrr,
                              extensions,
                              binder_key = nil,
                              ech_state = nil)
Severity: Minor
Found in lib/tttls1.3/client.rb - About 1 hr to fix

    Method deserialize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.deserialize(binary)
            raise Error::ErrorAlerts, :internal_error if binary.nil?
            raise Error::ErrorAlerts, :decode_error if binary.length < 39
            raise Error::ErrorAlerts, :internal_error \
              unless binary[0] == HandshakeType::CLIENT_HELLO
    Severity: Minor
    Found in lib/tttls1.3/message/client_hello.rb - About 1 hr to fix

      Method deserialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def self.deserialize(binary)
                raise Error::ErrorAlerts, :internal_error if binary.nil?
                return nil if binary.length < 2
      
                pskids_len = Convert.bin2i(binary.slice(0, 2))
      Severity: Minor
      Found in lib/tttls1.3/message/extension/pre_shared_key.rb - About 1 hr to fix

        Method deserialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def self.deserialize(binary)
                raise Error::ErrorAlerts, :internal_error if binary.nil?
                raise Error::ErrorAlerts, :decode_error if binary.length < 39
                raise Error::ErrorAlerts, :internal_error \
                  unless binary[0] == HandshakeType::SERVER_HELLO
        Severity: Minor
        Found in lib/tttls1.3/message/server_hello.rb - About 1 hr to fix

          Method offer_ech has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def self.offer_ech(inner, ech_config, hpke_cipher_suite_selector)
                return [new_greased_ch(inner, new_grease_ech), nil, nil] \
                  if ech_config.nil? ||
                     !SUPPORTED_ECHCONFIG_VERSIONS.include?(ech_config.version)
          
          
          Severity: Minor
          Found in lib/tttls1.3/ech.rb - About 1 hr to fix

            Method obj2html has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def obj2html(obj)
                    if obj.is_a?(OpenSSL::X509::Certificate)
                      obj.to_pem.gsub("\n", '<br>')
                    elsif obj.is_a?(Numeric) ||
                          obj.is_a?(TrueClass) || obj.is_a?(FalseClass)
            Severity: Minor
            Found in lib/tttls1.3/utils.rb - About 1 hr to fix

              Method deserialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def self.deserialize(binary, cipher, buffered = '',
                                         record_size_limit = DEFAULT_RECORD_SIZE_LIMIT)
                      raise Error::ErrorAlerts, :internal_error if binary.nil?
                      raise Error::ErrorAlerts, :decode_error if binary.length < 5
              
              
              Severity: Minor
              Found in lib/tttls1.3/message/record.rb - About 1 hr to fix

                Method sign_grease_psk_binder has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def sign_grease_psk_binder(ch1: nil,
                                               hrr: nil,
                                               ch_outer:,
                                               inner_psk:,
                                               binder_key:)
                Severity: Minor
                Found in lib/tttls1.3/client.rb - About 1 hr to fix

                  Method recv_message has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def recv_message(receivable_ccs:, cipher:)
                        return @message_queue.shift unless @message_queue.empty?
                  
                        messages = nil
                        orig_msgs = []
                  Severity: Minor
                  Found in lib/tttls1.3/connection.rb - About 1 hr to fix

                    Method gen_ch_extensions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def gen_ch_extensions
                          exs = Message::Extensions.new
                          # server_name
                          exs << Message::Extension::ServerName.new(@hostname)
                    
                    
                    Severity: Minor
                    Found in lib/tttls1.3/client.rb - 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

                    Method deserialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def self.deserialize(binary)
                            raise Error::ErrorAlerts, :internal_error if binary.nil?
                            raise Error::ErrorAlerts, :decode_error if binary.length < 5
                            raise Error::ErrorAlerts, :internal_error \
                              unless binary[0] == HandshakeType::COMPRESSED_CERTIFICATE
                    Severity: Minor
                    Found in lib/tttls1.3/message/compressed_certificate.rb - 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

                    Method deserialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def self.deserialize(binary)
                              raise Error::ErrorAlerts, :internal_error if binary.nil?
                    
                              return nil if binary.length < 2
                    
                    
                    Severity: Minor
                    Found in lib/tttls1.3/message/extension/alpn.rb - 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

                    Method check_invalid_certificate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def check_invalid_certificate(ct, ch)
                          return :illegal_parameter unless ct.appearable_extensions?
                    
                          return :unsupported_extension \
                            unless ct.certificate_list.map(&:extensions)
                    Severity: Minor
                    Found in lib/tttls1.3/client.rb - 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

                    Method encrypted_ech_config has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def self.encrypted_ech_config(ech_config, hpke_cipher_suite_selector)
                          public_name = ech_config.echconfig_contents.public_name
                          key_config = ech_config.echconfig_contents.key_config
                          public_key = key_config.public_key.opaque
                          kem_id = key_config&.kem_id&.uint16
                    Severity: Minor
                    Found in lib/tttls1.3/ech.rb - About 1 hr to fix

                      Method deserialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def self.deserialize(binary)
                              raise Error::ErrorAlerts, :internal_error if binary.nil?
                              raise Error::ErrorAlerts, :decode_error if binary.length < 13
                              raise Error::ErrorAlerts, :internal_error \
                                unless binary[0] == HandshakeType::NEW_SESSION_TICKET
                      Severity: Minor
                      Found in lib/tttls1.3/message/new_session_ticket.rb - About 1 hr to fix

                        Method verified_certificate_verify? has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def self.verified_certificate_verify?(public_key:, signature_scheme:,
                                                                  signature:, context:, hash:)
                              content = "\x20" * 64 + context + "\x00" + hash
                        
                              # RSA signatures MUST use an RSASSA-PSS algorithm, regardless of whether
                        Severity: Minor
                        Found in lib/tttls1.3/endpoint.rb - About 1 hr to fix

                          Method sign_certificate_verify has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def self.sign_certificate_verify(key:, signature_scheme:, context:, hash:)
                                content = "\x20" * 64 + context + "\x00" + hash
                          
                                # RSA signatures MUST use an RSASSA-PSS algorithm, regardless of whether
                                # RSASSA-PKCS1-v1_5 algorithms appear in "signature_algorithms".
                          Severity: Minor
                          Found in lib/tttls1.3/endpoint.rb - About 1 hr to fix

                            Method deserialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def self.deserialize(binary)
                                    raise Error::ErrorAlerts, :internal_error if binary.nil?
                                    raise Error::ErrorAlerts, :decode_error if binary.length < 5
                                    raise Error::ErrorAlerts, :internal_error \
                                      unless binary[0] == HandshakeType::COMPRESSED_CERTIFICATE
                            Severity: Minor
                            Found in lib/tttls1.3/message/compressed_certificate.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language