Class: Contrast::Agent::Assess::Rule::Base
- Includes:
- Components::Interface
- Defined in:
- lib/contrast/agent/assess/rule/base.rb
Overview
The base class for each of our Assess Rules
Direct Known Subclasses
Instance Method Summary collapse
- #enabled? ⇒ Boolean
-
#excluded?(exclusions) ⇒ Boolean
this rule is excluded if any of the given exclusions have a protection rule that matches this rule name.
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#name ⇒ Object
Should return the name as it is known to Teamserver; defaults to class.
- #postfilter(_context) ⇒ Object
- #prefilter(_context) ⇒ Object
-
#stream_safe? ⇒ Boolean
If a rule needs to inspect the response body it is not stream safe The rule should override this and return false.
Methods included from Components::Interface
Constructor Details
Instance Method Details
#enabled? ⇒ Boolean
27 28 29 |
# File 'lib/contrast/agent/assess/rule/base.rb', line 27 def enabled? ASSESS.enabled? && !ASSESS.rule_disabled?(name) end |
#excluded?(exclusions) ⇒ Boolean
this rule is excluded if any of the given exclusions have a protection rule that matches this rule name
43 44 45 46 47 |
# File 'lib/contrast/agent/assess/rule/base.rb', line 43 def excluded? exclusions Array(exclusions).any? do |ex| ex.assess_rule?(name) end end |
#name ⇒ Object
Should return the name as it is known to Teamserver; defaults to class
23 24 25 |
# File 'lib/contrast/agent/assess/rule/base.rb', line 23 def name cs__class.name end |
#postfilter(_context) ⇒ Object
39 |
# File 'lib/contrast/agent/assess/rule/base.rb', line 39 def postfilter _context; end |
#prefilter(_context) ⇒ Object
31 |
# File 'lib/contrast/agent/assess/rule/base.rb', line 31 def prefilter _context; end |
#stream_safe? ⇒ Boolean
If a rule needs to inspect the response body it is not stream safe The rule should override this and return false
35 36 37 |
# File 'lib/contrast/agent/assess/rule/base.rb', line 35 def stream_safe? true end |