Class: Contrast::Agent::Reporting::UserInput

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/agent/reporting/attack_result/user_input.rb

Overview

This class will hold the new Sqli detail used by RaspRuleSample

Constant Summary collapse

INPUT_TYPE =
Contrast::Agent::Reporting::InputType
DOCUMENT_TYPE =
{ XML: :XML, JSON: :JSON, NORMAL: :NORMAL }.cs__freeze

Instance Method Summary collapse

Instance Method Details

#document_typeObject

type [Symbol<:XML, :JSON, :NORMAL>]



63
64
65
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 63

def document_type
  @_document_type ||= DOCUMENT_TYPE[:NORMAL]
end

#document_type=(type) ⇒ Object



67
68
69
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 67

def document_type= type
  @_document_type = type if DOCUMENT_TYPE.value?(type)
end

#input_typeObject

Symbol<Contrast::Agent::Reporting::Settings::InputAnalysis::InputAnalysisResult::InputType>]

Returns:

  • @_input_type [



50
51
52
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 50

def input_type
  @_input_type ||= INPUT_TYPE::UNDEFINED_TYPE
end

#input_type=(input_type) ⇒ Object

Symbol<Contrast::Agent::Reporting::Settings::InputAnalysis::InputAnalysisResult::InputType>] Symbol<Contrast::Agent::Reporting::Settings::InputAnalysis::InputAnalysisResult::InputType>]

Parameters:

  • input_type

    [

Returns:

  • @_input_type [



58
59
60
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 58

def input_type= input_type
  @_input_type = input_type if INPUT_TYPE.to_a.include?(input_type)
end

#keyObject



27
28
29
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 27

def key
  @_key ||= Contrast::Utils::ObjectShare::EMPTY_STRING
end

#key=(key) ⇒ Object

Parameters:



33
34
35
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 33

def key= key
  @_key = key if key.is_a?(String)
end

#matcher_idsObject

Matchers IDs



73
74
75
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 73

def matcher_ids
  @_matcher_ids ||= []
end

#matcher_ids=(ids) ⇒ Object

Matchers IDs

Parameters:



80
81
82
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 80

def matcher_ids= ids
  @_matcher_ids = ids if ids.is_a?(Array) && ids.any?(String)
end

#pathObject



16
17
18
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 16

def path
  @_path ||= Contrast::Utils::ObjectShare::EMPTY_STRING
end

#path=(path) ⇒ Object

Parameters:



22
23
24
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 22

def path= path
  @_path = path if path.is_a?(String)
end

#to_controlled_hashObject



84
85
86
87
88
89
90
91
92
93
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 84

def to_controlled_hash
  {
      path: path,
      key: key,
      value: value,
      inputType: input_type.to_s,
      documentType: document_type.to_s,
      matcherIds: matcher_ids&.map(&:to_s)
  }
end

#valueObject



38
39
40
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 38

def value
  @_value ||= Contrast::Utils::ObjectShare::EMPTY_STRING
end

#value=(value) ⇒ Object

Parameters:



44
45
46
# File 'lib/contrast/agent/reporting/attack_result/user_input.rb', line 44

def value= value
  @_value = value if value.is_a?(String)
end