Sha256: 578f99af0a8895edfae7f7af9bb5f6ec5f06e2e07707da241d5e0eb893e3fbae
Contents?: true
Size: 1.58 KB
Versions: 15
Compression:
Stored size: 1.58 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 # This is the new FindingEventProperty class which will include all the needed information for the new reporting # system to relay this information in the Finding/Trace messages. Events have properties on them which are held # as an array of key-value pairs. class FindingEventProperty include Contrast::Components::Logger::InstanceMethods # @return [String] the key of the property attr_reader :key # @return [String] the value of the source attr_reader :value def initialize key, value @key = key @value = value 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('FindingEventProperty validation failed with: ', e) return end { key: key, value: value } end # @raise [ArgumentError] def validate raise(ArgumentError, "#{ self } did not have a proper key. Unable to continue.") unless key && !key.empty? end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems