Sha256: 8fae3414e889f488cf64a54e42338ce2a2a0818f97c09187c7a0b01fe693ff4d

Contents?: true

Size: 1.4 KB

Versions: 16

Compression:

Stored size: 1.4 KB

Contents

# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

module Contrast
  module Agent
    module Protect
      module Rule
        class NoSqli
          # The Mongo specific NoSQL scanner, used by the NoSQLI rule to
          # determine if a NoSQL attack was performed against a Mongo database.
          #
          # @deprecated RUBY-356
          class MongoNoSqlScanner < Contrast::Agent::Protect::Rule::DefaultScanner
            # Is the current & next character '//' or are the current and
            # subsequent characters '<--' ?
            def start_line_comment? char, index, query
              if char == Contrast::Utils::ObjectShare::SLASH &&
                    query[index + 1] == Contrast::Utils::ObjectShare::SLASH
                return true
              end

              char == Contrast::Utils::ObjectShare::LEFT_ANGLE &&
                  query[index + 1] == Contrast::Utils::ObjectShare::DASH &&
                  query[index + 2] == Contrast::Utils::ObjectShare::DASH
            end

            def start_block_comment? _char, _index, _query
              false
            end

            # Indicates if '""' inside of double quotes is the equivalent of '\"'
            def double_quote_escape_in_double_quote?
              true
            end
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
contrast-agent-3.15.0 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.14.0 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.13.2 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.13.1 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.13.0 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.12.2 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.12.1 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.12.0 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.11.0 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.10.2 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.10.1 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.10.0 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.9.1 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.9.0 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.8.5 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
contrast-agent-3.8.4 lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb