Sha256: 5f0daae311c693532121dadad42470587bbfeb01b4a1c75e6267b13ea67070a6

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 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/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'

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

            new_preflight = Contrast::Agent::Reporting::Preflight.new
            new_preflight_message = Contrast::Agent::Reporting::PreflightMessage.new
            finding.routes.each do |route|
              new_preflight_message.routes << route
            end
            new_preflight_message.hash_code = finding.hash_code
            new_preflight_message.data = "#{ finding.rule_id },#{ finding.hash_code }"
            new_preflight.messages << new_preflight_message
            new_preflight
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
contrast-agent-6.11.0 lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb
contrast-agent-6.10.0 lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb
contrast-agent-6.9.0 lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb
contrast-agent-6.8.0 lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb
contrast-agent-6.7.0 lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb