Sha256: 982711fd4a751c1db655183c2779ade555b0d72781a8da9400087173cadb2ebd
Contents?: true
Size: 1.56 KB
Versions: 3
Compression:
Stored size: 1.56 KB
Contents
# 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 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 NotImplementedError, 'This is abstract, override it.' end def name raise NotImplementedError, '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
3 entries across 3 versions & 1 rubygems