Sha256: ddb8763bfbcad773a7175437c06d6c4eefab6b17b0c27947455f299ddde052ea
Contents?: true
Size: 1.42 KB
Versions: 15
Compression:
Stored size: 1.42 KB
Contents
# Copyright (c) 2022 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 include Contrast::Components::Logger::InstanceMethods # @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 begin validate rescue ArgumentError => e logger.error('ObservedLibraryUsage validation failed with: ', e) return end { 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
15 entries across 15 versions & 1 rubygems