Class: Contrast::Agent::Protect::Rule::CmdiChainedCommand

Inherits:
CmdiBaseRule show all
Defined in:
lib/contrast/agent/protect/rule/cmdi/cmdi_chained_command.rb

Overview

The Ruby implementation of the Protect Command Injection Semantic Chained Command sub-rule. This rule should report

Constant Summary collapse

NAME =
'cmd-injection-semantic-chained-commands'

Constants inherited from CmdiBaseRule

Contrast::Agent::Protect::Rule::CmdiBaseRule::APPLICABLE_USER_INPUTS, Contrast::Agent::Protect::Rule::CmdiBaseRule::CHAINED_COMMAND_CHARS

Constants included from Reporting::InputType

Reporting::InputType::BODY, Reporting::InputType::COOKIE_NAME, Reporting::InputType::COOKIE_VALUE, Reporting::InputType::DWR_VALUE, Reporting::InputType::HEADER, Reporting::InputType::JSON_ARRAYED_VALUE, Reporting::InputType::JSON_VALUE, Reporting::InputType::METHOD, Reporting::InputType::MULTIPART_CONTENT_TYPE, Reporting::InputType::MULTIPART_FIELD_NAME, Reporting::InputType::MULTIPART_NAME, Reporting::InputType::MULTIPART_VALUE, Reporting::InputType::PARAMETER_NAME, Reporting::InputType::PARAMETER_VALUE, Reporting::InputType::QUERYSTRING, Reporting::InputType::REQUEST, Reporting::InputType::SOCKET, Reporting::InputType::UNDEFINED_TYPE, Reporting::InputType::UNKNOWN, Reporting::InputType::URI, Reporting::InputType::URL_PARAMETER, Reporting::InputType::XML_VALUE

Constants inherited from Base

Base::BLOCKING_MODES, Base::RULE_NAME, Base::STACK_COLLECTION_RESULTS, Base::SUSPICIOUS_REPORTING_RULES

Constants included from Filters

Filters::POSTFILTER_MODES

Instance Attribute Summary

Attributes inherited from Base

#mode

Instance Method Summary collapse

Methods inherited from CmdiBaseRule

#build_attack_with_match, #classification, #infilter

Methods included from Reporting::InputType

to_a

Methods included from Components::Logger::InstanceMethods

#cef_logger, #logger

Methods inherited from Base

#append_to_activity, #block_message, #cef_logging, #classification, #classify, #enabled?, #excluded?, #initialize, #stream_safe?, #update

Methods included from Filters

#infilter, #postfilter, #postfilter?, #prefilter, #prefilter?

Methods included from Builders

#build_attack_result, #build_attack_with_match, #build_attack_without_match, #build_base_sample, #build_sample, #build_violation

Methods included from Components::Scope::InstanceMethods

#contrast_enter_method_scopes!, #contrast_exit_method_scopes!, #with_app_scope, #with_contrast_scope, #with_deserialization_scope, #with_split_scope

Constructor Details

This class inherits a constructor from Contrast::Agent::Protect::Rule::Base

Instance Method Details

#infilter?(command) ⇒ Boolean

Parameters:

  • command (String)

    potential dangerous command executed.

Returns:

  • (Boolean)


27
28
29
30
31
32
# File 'lib/contrast/agent/protect/rule/cmdi/cmdi_chained_command.rb', line 27

def infilter? command
  return unless enabled?
  return unless chained_command?(command)

  true
end

#rule_nameObject



18
19
20
# File 'lib/contrast/agent/protect/rule/cmdi/cmdi_chained_command.rb', line 18

def rule_name
  NAME
end

#sub_rulesObject



22
23
24
# File 'lib/contrast/agent/protect/rule/cmdi/cmdi_chained_command.rb', line 22

def sub_rules
  Contrast::Utils::ObjectShare::EMPTY_ARRAY
end