lib/contrast/agent/assess/policy/trigger_method.rb in contrast-agent-6.0.0 vs lib/contrast/agent/assess/policy/trigger_method.rb in contrast-agent-6.1.0
- old
+ new
@@ -10,10 +10,11 @@
require 'contrast/agent/assess/events/event_data'
require 'contrast/agent/reporting/reporting_events/preflight'
require 'contrast/agent/reporting/reporting_events/preflight_message'
require 'contrast/agent/reporting/reporting_events/route_discovery'
require 'contrast/agent/reporting/reporting_utilities/reporting_storage'
+require 'contrast/agent/reporting/reporting_utilities/build_preflight'
module Contrast
module Agent
module Assess
module Policy
@@ -150,21 +151,12 @@
# here we will generate new type of finding
ruby_finding = Contrast::Agent::Reporting::Finding.new trigger_node.rule_id
ruby_finding.attach_data trigger_node, source, object, ret, request, *args
hash_code = Contrast::Utils::HashDigest.generate_event_hash(ruby_finding, source, request)
ruby_finding.hash_code = hash_code
- # save the current finding
- Contrast::Agent::Reporting::ReportingStorage[hash_code] = ruby_finding
- new_preflight = Contrast::Agent::Reporting::Preflight.new
- new_preflight_message = Contrast::Agent::Reporting::PreflightMessage.new
- if request.route
- new_preflight_message.routes << Contrast::Agent::Reporting::RouteDiscovery.convert(request.route)
- end
- new_preflight_message.hash_code = hash_code
- new_preflight_message.data = "#{ trigger_node.rule_id },#{ hash_code }"
- new_preflight.messages << new_preflight_message
- Contrast::Agent.reporter&.send_event_immediately(new_preflight)
+ new_preflight = Contrast::Agent::Reporting::BuildPreflight.build(ruby_finding, request)
+ Contrast::Agent.reporter&.send_event(new_preflight)
end
private
def settings