Class: Contrast::AgentLib::InterfaceBase
- Defined in:
- lib/contrast/agent_lib/interface_base.rb
Overview
Base class to set basic rule sets and input list.
Direct Known Subclasses
Constant Summary collapse
- LOG_LEVEL =
{ -1 => 'OFF', 0 => 'TRACE', 1 => 'DEBUG', 2 => 'INFO', 3 => 'WARN', 4 => 'ERROR' }.cs__freeze
- LOG_DIR =
File.join(Dir.pwd).cs__freeze
Instance Method Summary collapse
-
#db_set ⇒ Hash
Return the AgentLib supported Database types.
-
#eval_option ⇒ Hash
Return list of input evaluation options: WorthWatching or none.
-
#initialize(enable_logging = nil, set_log_level = nil, set_log_dir = nil) ⇒ Boolean
constructor
Initializes the Agent lib.
-
#input_set ⇒ Hash
Returns list of available input types.
-
#rule_set ⇒ Hash
Return list of available rules.
Constructor Details
#initialize(enable_logging = nil, set_log_level = nil, set_log_dir = nil) ⇒ Boolean
Initializes the Agent lib.
likely to be a C segfaults and termination, probably redundant but safe.
23 24 25 |
# File 'lib/contrast/agent_lib/interface_base.rb', line 23 def initialize enable_logging = nil, set_log_level = nil, set_log_dir = nil # Override end |
Instance Method Details
#db_set ⇒ Hash
Return the AgentLib supported Database types.
52 53 54 |
# File 'lib/contrast/agent_lib/interface_base.rb', line 52 def db_set @_db_set ||= extract_constants(ContrastAgentLib::DbType) end |
#eval_option ⇒ Hash
Return list of input evaluation options: WorthWatching or none
60 61 62 63 64 65 66 67 |
# File 'lib/contrast/agent_lib/interface_base.rb', line 60 def eval_option @_eval_option ||= begin consts = extract_constants(ContrastAgentLib::EvalOptions).dup # Adding the option to call the AgentLib without WorthWatching: consts[:NONE] = 0 consts.cs__freeze end end |
#input_set ⇒ Hash
Returns list of available input types
45 46 47 |
# File 'lib/contrast/agent_lib/interface_base.rb', line 45 def input_set @_input_set ||= extract_constants(ContrastAgentLib::InputType) end |
#rule_set ⇒ Hash
Return list of available rules. On first call the constants are extracted from the gem and set to resemble the protect rules ids used across the agent, e.g. CMD_INJECTIONS => cmd-injection.
*** Note that the NoSQLI rules is used within the agent, but in future need arise to be used with the AgentLib, the rule_id for that rule atm is ‘nosql-injection-mongo’ ***
All the rules types extracted from the AgentLib gem will have value corresponding to an ulong enum in Rust land. module name, or if module was renamed.
38 39 40 |
# File 'lib/contrast/agent_lib/interface_base.rb', line 38 def rule_set @_rule_set ||= extract_constants(ContrastAgentLib::RuleType, to_rule_id: true) end |