Class: Contrast::Agent::Reporting::Settings::RuleDefinition
- Defined in:
- lib/contrast/agent/reporting/settings/rule_definition.rb
Overview
The keywords and patterns required for the input analysis of each rule with that capability.
Constant Summary collapse
- ATTRIBUTES =
%i[name keywords patterns].cs__freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
For the ServerSettings this name is not used instead it is used as key to the keywords and patterns arrays.
Instance Method Summary collapse
-
#keywords ⇒ array<Contrast::Agent::Reporting::Settings::Keyword>
The words to search for in input that indicate an attack.
-
#keywords=(keywords_array) ⇒ array<Contrast::Agent::Reporting::Settings::Keyword>
Set keywords.
-
#patterns ⇒ array<Contrast::Agent::Reporting::Settings::Pattern>
A word or pattern whose presence in an input represents an attack.
-
#patterns=(patterns_array) ⇒ array<Contrast::Agent::Reporting::Settings::Pattern>
Set patterns.
- #to_controlled_hash ⇒ Object
Instance Attribute Details
#name ⇒ Object
For the ServerSettings this name is not used instead it is used as key to the keywords and patterns arrays. It is used in the agent startup message.
19 20 21 |
# File 'lib/contrast/agent/reporting/settings/rule_definition.rb', line 19 def name @name end |
Instance Method Details
#keywords ⇒ array<Contrast::Agent::Reporting::Settings::Keyword>
The words to search for in input that indicate an attack
24 25 26 |
# File 'lib/contrast/agent/reporting/settings/rule_definition.rb', line 24 def keywords @_keywords ||= [] end |
#keywords=(keywords_array) ⇒ array<Contrast::Agent::Reporting::Settings::Keyword>
Set keywords.
39 40 41 42 43 |
# File 'lib/contrast/agent/reporting/settings/rule_definition.rb', line 39 def keywords= keywords_array Contrast::Agent::Reporting::Settings::Helpers.array_to_iv(Contrast::Agent::Reporting::Settings::Keyword, keywords, keywords_array) end |
#patterns ⇒ array<Contrast::Agent::Reporting::Settings::Pattern>
A word or pattern whose presence in an input represents an attack
31 32 33 |
# File 'lib/contrast/agent/reporting/settings/rule_definition.rb', line 31 def patterns @_patterns ||= [] end |
#patterns=(patterns_array) ⇒ array<Contrast::Agent::Reporting::Settings::Pattern>
Set patterns.
49 50 51 52 53 |
# File 'lib/contrast/agent/reporting/settings/rule_definition.rb', line 49 def patterns= patterns_array Contrast::Agent::Reporting::Settings::Helpers.array_to_iv(Contrast::Agent::Reporting::Settings::Pattern, patterns, patterns_array) end |
#to_controlled_hash ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/contrast/agent/reporting/settings/rule_definition.rb', line 55 def to_controlled_hash { name: name, # rubocop:disable Security/Module/Name keywords: keywords.map(&:to_controlled_hash), patterns: patterns.map(&:to_controlled_hash) } end |