Class: Contrast::Agent::Reporting::AttackResult

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

Overview

This class will hold the new Attacks results generated by our protect rules.

Constant Summary collapse

RESPONSE_TYPE =
Contrast::Agent::Reporting::ResponseType

Instance Method Summary collapse

Instance Method Details

#detailsObject



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

def details
  @_details ||= {}
end

#details=(protect_details) ⇒ Object



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

def details= protect_details
  @_details = protect_details if protect_details.is_a?(Contrast::Agent::Reporting::Details::ProtectRuleDetails)
end

#empty?Boolean

Returns:

  • (Boolean)


70
71
72
73
# File 'lib/contrast/agent/reporting/attack_result/attack_result.rb', line 70

def empty?
  Contrast::Utils::DuckUtils.empty_duck?(samples) || Contrast::Utils::DuckUtils.empty_duck?(rule_id) ||
      response == ::Contrast::Agent::Reporting::ResponseType::NO_ACTION
end

#responseObject

Generated the attack result



20
21
22
# File 'lib/contrast/agent/reporting/attack_result/attack_result.rb', line 20

def response
  @_response ||= RESPONSE_TYPE::NO_ACTION
end

#response=(response_type) ⇒ Object

sets the response_type

Parameters:

  • response_type (Contrast::Agent::Reporting::Settings::InputAnalysisResult)

Returns:

  • @_response_type []



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

def response= response_type
  @_response = response_type if RESPONSE_TYPE.to_a.include?(response_type)
end

#rule_idObject



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

def rule_id
  @_rule_id ||= Contrast::Utils::ObjectShare::EMPTY_STRING
end

#rule_id=(rule_id) ⇒ Object

Parameters:



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

def rule_id= rule_id
  @_rule_id = rule_id if rule_id.is_a?(String)
end

#samplesObject



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

def samples
  @_samples ||= []
end

#samples=(samples) ⇒ Object

Parameters:



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

def samples= samples
  @_samples = samples if samples.is_a?(Array)
end

#tagsObject



54
55
56
# File 'lib/contrast/agent/reporting/attack_result/attack_result.rb', line 54

def tags
  @_tags ||= Contrast::Utils::ObjectShare::EMPTY_STRING
end

#tags=(tags) ⇒ Object



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

def tags= tags
  @_tags = tags if tags.is_a?(String)
end