Class: Contrast::Agent::Reporting::FindingEventTaintRange
- Inherits:
-
ReportableHash
- Object
- ReportableHash
- Contrast::Agent::Reporting::FindingEventTaintRange
- Defined in:
- lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb
Overview
This is the new FindingEventTaintRange class which will include all the needed information for the new reporting system to relay this information in the Finding/Trace messages. These FindingTaintRanges are used by TeamServer to construct the vulnerability information for the assess feature. They represent those parts of the objects that are tracked because of a security relevant operation acting on them.
Instance Attribute Summary collapse
-
#range ⇒ String
readonly
The range (inclusive:exclusive), that this tag covers.
-
#tag ⇒ String
readonly
The type of action this tag represents.
Class Method Summary collapse
Instance Method Summary collapse
-
#attach_data(tag) ⇒ Object
Parse the data from a Contrast::Agent::Assess::Tag to attach what is required for reporting to TeamServer to this Contrast::Agent::Reporting::FindingEventTaintRange.
-
#to_controlled_hash ⇒ Hash
Convert the instance variables on the class, and other information, into the identifiers required for TeamServer to process the JSON form of this message.
- #validate ⇒ Object
Methods inherited from ReportableHash
Methods included from Components::Logger::InstanceMethods
Instance Attribute Details
#range ⇒ String (readonly)
Returns the range (inclusive:exclusive), that this tag covers.
18 19 20 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb', line 18 def range @range end |
#tag ⇒ String (readonly)
Returns the type of action this tag represents.
20 21 22 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb', line 20 def tag @tag end |
Class Method Details
.convert(tag) ⇒ Contrast::Agent::Reporting::FindingEventTaintRange
25 26 27 28 29 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb', line 25 def convert tag report = new report.attach_data(tag) report end |
Instance Method Details
#attach_data(tag) ⇒ Object
Parse the data from a Contrast::Agent::Assess::Tag to attach what is required for reporting to TeamServer to this Contrast::Agent::Reporting::FindingEventTaintRange
36 37 38 39 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb', line 36 def attach_data tag @range = "#{ tag.start_idx }:#{ tag.end_idx }" @tag = tag.label end |
#to_controlled_hash ⇒ Hash
Convert the instance variables on the class, and other information, into the identifiers required for TeamServer to process the JSON form of this message.
46 47 48 49 50 51 52 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb', line 46 def to_controlled_hash validate { range: range, tag: tag } end |
#validate ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb', line 55 def validate if Contrast::Utils::DuckUtils.empty_duck?(range) # rubocop:disable Style/GuardClause raise(ArgumentError, "#{ self } did not have a proper range. Unable to continue.") elsif Contrast::Utils::DuckUtils.empty_duck?(tag) raise(ArgumentError, "#{ self } did not have a proper tag. Unable to continue.") end nil end |