Sha256: 0e61aaaa4d224fbb65affbf31850d6439d752a52996d121831501b86cf66ebcc
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 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' require 'contrast/agent/reporting/reporting_events/application_defend_attack_sample' module Contrast module Agent module Reporting # This is the new AttackerSampleActivity class which will include Sample of the given attacks in the activity # period. class ApplicationDefendAttackSampleActivity class << self def convert attack_samples activity = new activity.attach_data attack_samples activity end end def initialize @samples = [] @start_time = (Contrast::Agent::REQUEST_TRACKER.current&.timer&.start_ms || 0) @event_type = :application_defend_attack_sample_activity super end def to_controlled_hash { attackTimeMap: attack_time_map, samples: @samples.map(&:to_controlled_hash), startTime: @start_time, total: 1 # there will only ever be 1 attack sample, until batching is done } end # @param inventory_dtm [Contrast::Api::Dtm::ApplicationUpdate] # @return [Contrast::Agent::Reporting::ApplicationInventory] # TODO: RUBY-9999 update to handle batching def attach_data attack_sample @samples << Contrast::Agent::Reporting::ApplicationDefendAttackSample.convert(attack_sample) end def attack_time_map { second: duration, count: 1 # there will only ever be 1 attack sample, until batching is done } end def duration Contrast::Utils::Timer.now_ms - @start_time end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-6.1.0 | lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample_activity.rb |