Sha256: 5d36307d8ee62d1f66b051ad2487f898604c8cef54a4d7bcd56dc648d5c34fc4
Contents?: true
Size: 1.56 KB
Versions: 5
Compression:
Stored size: 1.56 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/components/logger' module Contrast module Agent module Reporting # The usage, meaning loaded files, of a library seen during this request class LibraryUsageObservation include Contrast::Components::Logger::InstanceMethods # @param [String] Sha256Sum of library as identified by the agent attr_reader :id # @param [Array<String>] List of file paths that have been loaded out of or executed by the library attr_reader :names # @param id [String] Sha256Sum of library as identified by the agent # @param class_names [Array<String>] List of file paths that have been loaded out of or executed by the library def initialize id, class_names @id = id @names = class_names end # @raise [ArgumentError] def to_controlled_hash begin validate rescue ArgumentError => e logger.error('LibraryUsageObservation validation failed with: ', e) return end { id: @id, names: @names } end # @raise [ArgumentError] def validate raise(ArgumentError, "#{ self } did not have a proper id. Unable to continue.") unless id raise(ArgumentError, "#{ self } did not have a proper names. Unable to continue.") if names.empty? end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems