lib/contrast/utils/hash_digest.rb in contrast-agent-5.1.0 vs lib/contrast/utils/hash_digest.rb in contrast-agent-5.2.0

- old
+ new

@@ -27,24 +27,32 @@ # Update to CRC checksum the finding route and verb if finding route # [Contrast::Api::Dtm::RouteCoverage] is available else update the passed # request or Contrast::REQUEST_TRACKER.current.request uri and used request # method. # - # @param finding [Contrast::Api::Dtm::Finding] finding to be reported + # @param finding [Contrast::Api::Dtm::Finding, Contrast::Agent::Reporting::Finding] finding to be reported # @param request [Contrast::Agent::Request] our wrapper around the Rack::Request. # @return checksum [Integer, nil] returns nil if there is no request context or tracking # is disabled. def update_on_request finding, request context = Contrast::Agent::REQUEST_TRACKER.current return unless context || ::Contrast::ASSESS.non_request_tracking? if (route = finding.routes[0]) - update(route.route) # the normalized URL used to access the method in the route. - update(route.verb) # the HTTP Verb used to access the method in the route. - elsif request ||= context&.request - update(request.normalized_uri) # the normalized URL used to access the method in the route. - update(request.request_method) # The HTTP method used in the request + if finding.cs__is_a?(Contrast::Agent::Reporting::Finding) && (observation = route.observations[0]) + update(observation.url) + update(observation.verb) + else + update(route.route) # the normalized URL used to access the method in the route. + update(route.verb) # the HTTP Verb used to access the method in the route. + end + return end + + return unless request ||= context&.request + + update(request.normalized_uri) # the normalized URL used to access the method in the route. + update(request.request_method) # The HTTP method used in the request end # Update to CRC checksum the event source name and source type. # Expects Contrast::Api::Dtm::TraceEvent || Contrast::Agent::Assess::Events::SourceEvent #