Sha256: 9806ff4c3a6f22c0f12dcb5a05e5bd4393ba256c28d79825c264e60b311b85ab
Contents?: true
Size: 1.53 KB
Versions: 6
Compression:
Stored size: 1.53 KB
Contents
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/components/interface' module Contrast module Agent module Protect module Policy # This Module is the base of our Protect Applicators. It lays out the # form of the Applicator, which will override specific implementations # in order to properly invoke its Rule. module RuleApplicator include Contrast::Components::Interface access_component :analysis, :logging def apply_rule method, exception, properties, object, args invoke(method, exception, properties, object, args) rescue Contrast::SecurityException => e raise e rescue StandardError => e logger.error('Error applying protect rule', e, module: object.cs__class.cs__name, method: method, rule: name) end protected def invoke _method, _exception, _properties, _object, _args raise NoMethodError, 'This is abstract, override it.' end def name raise NoMethodError, 'This is abstract, override it.' end def rule PROTECT.rule name end def skip_analysis? context = Contrast::Agent::REQUEST_TRACKER.current return true unless context&.app_loaded? return true unless rule&.enabled? false end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems