# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/utils/object_share' require 'contrast/utils/timer' require 'contrast/agent/reporting/attack_result/response_type' require 'contrast/agent/reporting/attack_result/rasp_rule_sample' module Contrast module Agent module Reporting # This class will hold the new Attacks results generated by our # protect rules. class AttackResult RESPONSE_TYPE = Contrast::Agent::Reporting::ResponseType # Generated the attack result # # @return @_response_type [Contrast::Agent::Reporting::ResponseType] def response @_response ||= RESPONSE_TYPE::NO_ACTION end # sets the response_type # # @param response_type [Contrast::Agent::Reporting::Settings::InputAnalysisResult] # @return @_response_type [] def response= response_type @_response = response_type if RESPONSE_TYPE.to_a.include?(response_type) end # @return @_rule_id [String] def rule_id @_rule_id ||= Contrast::Utils::ObjectShare::EMPTY_STRING end # @param rule_id [String] # @return @_rule_id [String] def rule_id= rule_id @_rule_id = rule_id if rule_id.is_a?(String) end # @return @_samples [Array] def samples @_samples ||= [] end # @param samples [Array] # @return @_samples [Array] def samples= samples @_samples = samples if samples.is_a?(Array) end def tags @_tags ||= Contrast::Utils::ObjectShare::EMPTY_STRING end def tags= tags @_tags = tags if tags.is_a?(String) end def details @_details ||= {} end def details= protect_details @_details = protect_details if protect_details.is_a?(Contrast::Agent::Reporting::Details::ProtectRuleDetails) end end end end end