lib/contrast/utils/invalid_configuration_util.rb in contrast-agent-4.14.1 vs lib/contrast/utils/invalid_configuration_util.rb in contrast-agent-5.0.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. +# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/agent/assess/policy/trigger_method' require 'contrast/components/logger' require 'contrast/components/scope' @@ -31,13 +31,14 @@ finding.rule_id = rule_id set_properties(finding, user_provided_options, call_location) hash = Contrast::Utils::HashDigest.generate_config_hash(finding) finding.hash_code = Contrast::Utils::StringUtils.force_utf8(hash) finding.preflight = Contrast::Utils::PreflightUtil.create_preflight(finding) - Contrast::Agent::Assess::Policy::TriggerMethod.report_finding(finding) - if Contrast::Agent::Reporter.enabled? - cs__report_new_finding hash, rule_id, user_provided_options, call_location + if Contrast::Agent::Reporter.enabled? # TODO: RUBY-1438 -- remove + cs__report_new_finding(hash, rule_id, user_provided_options, call_location) + else + Contrast::Agent::Assess::Policy::TriggerMethod.report_finding(finding) end end rescue StandardError => e logger.error('Unable to build a finding', e, rule: rule_id) end @@ -50,10 +51,10 @@ new_preflight.messages << new_preflight_message ruby_finding = Contrast::Agent::Reporting::Finding.new rule_id ruby_finding.hash_code = hash_code set_new_finding_properties(ruby_finding, user_provided_options, call_location) - Contrast::Agent.reporter_queue.send_event_immediately(new_preflight) + Contrast::Agent.reporter&.send_event_immediately(new_preflight) Contrast::Agent::Reporting::ReportingStorage[hash_code] = ruby_finding end private