Sha256: 7dfba01516ea5326fd34d2ef393f5696e534fe7b87b3969bdcbc3795de41bc41

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

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

require 'contrast/agent/reporting/reporting_events/application_reporting_event'
require 'contrast/agent/reporting/reporting_events/library_usage_observation'
require 'contrast/components/logger'

module Contrast
  module Agent
    module Reporting
      # List of libraries that have been observed to have something loaded or executed.
      class ObservedLibraryUsage < Contrast::Agent::Reporting::ApplicationReportingEvent
        # @return Array[Contrast::Agent::Reporting::LibraryUsageObservation]
        attr_reader :observations

        def initialize
          @event_endpoint = Contrast::Agent::Reporting::Endpoints.library_usage
          @observations = []
          super()
        end

        def file_name
          'library-observation'
        end

        def to_controlled_hash
          validate
          { observations: @observations.map(&:to_controlled_hash) }
        end

        def validate
          raise(ArgumentError, "#{ self } did not have observations. Unable to continue.") if observations.empty?
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
contrast-agent-7.3.2 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-7.3.1 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-7.3.0 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-7.2.0 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-7.1.0 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-7.0.0 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-6.15.3 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-6.15.2 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-6.15.1 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-6.15.0 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-6.14.0 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-6.13.0 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
contrast-agent-6.12.0 lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb