Sha256: 1e47640f5ca29d269a53c412978d3f8429c68473fe53c9c2def91fee7557b87a
Contents?: true
Size: 1.53 KB
Versions: 3
Compression:
Stored size: 1.53 KB
Contents
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/agent/reporting/reporting_events/preflight_message' require 'contrast/agent/reporting/reporting_events/preflight' require 'contrast/agent/reporting/reporting_events/route_discovery' require 'contrast/agent/reporting/reporting_utilities/reporting_storage' require 'contrast/utils/duck_utils' module Contrast module Agent module Reporting # This module will handle the building of new preflights prior to # sending them. module BuildPreflight class << self # @param finding [Contrast::Agent::Reporting::Finding] # @return [Contrast::Agent::Reporting::Preflight, nil] def generate finding return unless finding&.cs__is_a?(Contrast::Agent::Reporting::Finding) new_preflight = Contrast::Agent::Reporting::Preflight.new new_preflight_message = Contrast::Agent::Reporting::PreflightMessage.new routes = finding.routes unless Contrast::Utils::DuckUtils.empty_duck?(routes) routes.each { |route| new_preflight_message.routes << route } end new_preflight_message.data = "#{ finding.rule_id },#{ finding.hash_code }" new_preflight.messages << new_preflight_message return new_preflight unless Contrast::Utils::DuckUtils.empty_duck?(new_preflight.messages) nil end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems