Class: Contrast::Agent::Reporting::InputAnalysis
- Defined in:
- lib/contrast/agent/reporting/input_analysis/input_analysis.rb
Overview
This class will do ia analysis for our protect rules
Instance Attribute Summary collapse
-
#inputs ⇒ Hash
Stored request inputs for this context.
Instance Method Summary collapse
-
#analysed_rules ⇒ Array<String>
Records rules with input analysis for current request.
-
#no_inputs? ⇒ Boolean
Check if the InputAnalysis is empty.
-
#record_analysed_rule(rule_name) ⇒ Object
We add the analysed rules to the list.
-
#record_rule_triggered(rule_name) ⇒ Object
We add the triggered rules to the list.
-
#request ⇒ Object
Returns our wrapper around the Rack::Request for this context.
-
#request=(request) ⇒ Object
Sets current request.
-
#results ⇒ Object
result from input analysis.
-
#results=(results) ⇒ Object
result from input analysis.
-
#triggered_rules ⇒ Array<String>
Records rules triggered on sink.
Instance Attribute Details
#inputs ⇒ Hash
Returns Stored request inputs for this context.
14 15 16 |
# File 'lib/contrast/agent/reporting/input_analysis/input_analysis.rb', line 14 def inputs @inputs end |
Instance Method Details
#analysed_rules ⇒ Array<String>
Records rules with input analysis for current request.
26 27 28 |
# File 'lib/contrast/agent/reporting/input_analysis/input_analysis.rb', line 26 def analysed_rules @_analysed_rules ||= [] end |
#no_inputs? ⇒ Boolean
Check if the InputAnalysis is empty.
60 61 62 |
# File 'lib/contrast/agent/reporting/input_analysis/input_analysis.rb', line 60 def no_inputs? Contrast::Utils::DuckUtils.empty_duck?(inputs) end |
#record_analysed_rule(rule_name) ⇒ Object
We add the analysed rules to the list. The IA won’t be build for this rule, since already it’s already available.
68 69 70 |
# File 'lib/contrast/agent/reporting/input_analysis/input_analysis.rb', line 68 def record_analysed_rule rule_name analysed_rules << rule_name unless triggered_rules.include?(rule_name) end |
#record_rule_triggered(rule_name) ⇒ Object
We add the triggered rules to the list. After request analysis will skip this rule as already triggered.
76 77 78 |
# File 'lib/contrast/agent/reporting/input_analysis/input_analysis.rb', line 76 def record_rule_triggered rule_name triggered_rules << rule_name unless triggered_rules.include?(rule_name) end |
#request ⇒ Object
Returns our wrapper around the Rack::Request for this context
47 48 49 |
# File 'lib/contrast/agent/reporting/input_analysis/input_analysis.rb', line 47 def request @_request ||= nil end |
#request=(request) ⇒ Object
Sets current request
55 56 57 |
# File 'lib/contrast/agent/reporting/input_analysis/input_analysis.rb', line 55 def request= request @_request = request if request.instance_of?(Contrast::Agent::Request) end |
#results ⇒ Object
result from input analysis
33 34 35 |
# File 'lib/contrast/agent/reporting/input_analysis/input_analysis.rb', line 33 def results @_results ||= [] end |
#results=(results) ⇒ Object
result from input analysis
40 41 42 |
# File 'lib/contrast/agent/reporting/input_analysis/input_analysis.rb', line 40 def results= results @_results = results end |
#triggered_rules ⇒ Array<String>
Records rules triggered on sink.
19 20 21 |
# File 'lib/contrast/agent/reporting/input_analysis/input_analysis.rb', line 19 def triggered_rules @_triggered_rules ||= [] end |