Sha256: f7e4f96f0138ee23ba6d374c38d2f02463f86882b8bab60e62ea4c903f0df9e6

Contents?: true

Size: 1.57 KB

Versions: 15

Compression:

Stored size: 1.57 KB

Contents

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

require 'base64'
require 'contrast/components/logger'

module Contrast
  module Agent
    module Reporting
      # This is the new FindingEventParentObject class which will include all the needed information for the new
      # reporting system to relay this information in the Finding/Trace messages. These FindingEventParentObject are
      # used by TeamServer to relate this event to those that came previously. They represent the events that directly
      # preceding the FindingEvent generated.
      class FindingEventParentObject
        include Contrast::Components::Logger::InstanceMethods

        # @return [Integer] the Id of the parent event
        attr_reader :id

        def initialize id
          @id = id
        end

        # Convert the instance variables on the class, and other information, into the identifiers required for
        # TeamServer to process the JSON form of this message.
        #
        # @return [Hash]
        # @raise [ArgumentError]
        def to_controlled_hash
          begin
            validate
          rescue ArgumentError => e
            logger.error('FindingEventParentObject validation failed with: ', e)
            return
          end

          {
              id: id
          }
        end

        # @raise [ArgumentError]
        def validate
          raise(ArgumentError, "#{ self } did not have a proper id. Unable to continue.") unless id
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
contrast-agent-6.11.0 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.10.0 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.9.0 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.8.0 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.7.0 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.6.5 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.6.4 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.6.3 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.6.2 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.6.1 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.6.0 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.5.1 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.5.0 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.4.0 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb
contrast-agent-6.3.0 lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb