lib/contrast/utils/assess/tracking_util.rb in contrast-agent-3.10.2 vs lib/contrast/utils/assess/tracking_util.rb in contrast-agent-3.11.0

- old
+ new

@@ -1,13 +1,19 @@ # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true +cs__scoped_require 'contrast/components/interface' + module Contrast module Utils module Assess # TrackingUtil has methods for determining if a object is being tracked class TrackingUtil + include Contrast::Components::Interface + + access_component :logging + def self.tracked? obj return false if obj.nil? if Contrast::Utils::DuckUtils.iterable_hash?(obj) obj.each_pair do |k, v| @@ -26,10 +32,10 @@ end rescue StandardError => e # This is used to ask if a ton of objects are tracked. They may not # all be iterable. Bad things could happen in some cases, like when # checking a closed statement for SQL injection trigger events - logger.warn("#{ e } trying to TrackingUtil.tracked? on object of class #{ obj.cs__class }.") + logger.warn('Failed to determine tracking', e, module: obj.cs__class) false end end end end