Class: Contrast::Agent::Protect::Rule::NoSqli::MongoNoSqlScanner Deprecated

Inherits:
DefaultScanner show all
Defined in:
lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb

Overview

Deprecated.

RUBY-356

The Mongo specific NoSQL scanner, used by the NoSQLI rule to determine if a NoSQL attack was performed against a Mongo database.

Constant Summary

Constants inherited from DefaultScanner

DefaultScanner::OPERATOR_PATTERN

Instance Method Summary collapse

Methods inherited from DefaultScanner

#crosses_boundary

Instance Method Details

#double_quote_escape_in_double_quote?Boolean

Indicates if ‘“”’ inside of double quotes is the equivalent of ‘"’

Returns:

  • (Boolean)


31
32
33
# File 'lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb', line 31

def double_quote_escape_in_double_quote?
  true
end

#start_block_comment?(_char, _index, _query) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb', line 26

def start_block_comment? _char, _index, _query
  false
end

#start_line_comment?(char, index, query) ⇒ Boolean

Is the current & next character ‘//’ or are the current and subsequent characters ‘<–’ ?

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
# File 'lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb', line 16

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