Class: Contrast::Agent::Protect::Rule::UnsafeFileUpload

Inherits:
Base
  • Object
show all
Includes:
Reporting::InputType
Defined in:
lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload.rb

Overview

The Ruby implementation of the Protect Unsafe File Upload rule. The unsafe-file-upload rule can trigger the following results: BLOCKED in Blocking mode and SUSPICIOUS in Monitor mode.

Constant Summary collapse

NAME =
'unsafe-file-upload'
BLOCK_MESSAGE =
'Unsafe file upload rule triggered. Request blocked.'
APPLICABLE_USER_INPUTS =
[MULTIPART_NAME, MULTIPART_FIELD_NAME].cs__freeze

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 included from Reporting::InputType

to_a

Methods inherited from Base

#append_to_activity, #cef_logging, #classify, #enabled?, #excluded?, #initialize, #stream_safe?, #sub_rules, #update

Methods included from Filters

#infilter, #infilter?, #postfilter, #postfilter?, #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

Methods included from Components::Logger::InstanceMethods

#cef_logger, #logger

Constructor Details

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

Instance Method Details

#applicable_user_inputsObject



27
28
29
# File 'lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload.rb', line 27

def applicable_user_inputs
  APPLICABLE_USER_INPUTS
end

#block_messageString

Return the specific blocking message for this rule.

Returns:

  • (String)

    the reason for the raised security exception.



34
35
36
# File 'lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload.rb', line 34

def block_message
  BLOCK_MESSAGE
end

#classificationmodule<Contrast::Agent::Protect::Rule::UnsafeFileUploadInputClassification>

Unsafe File Upload input classification



41
42
43
# File 'lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload.rb', line 41

def classification
  @_classification ||= Contrast::Agent::Protect::Rule::UnsafeFileUploadInputClassification.cs__freeze
end

#rule_nameObject



23
24
25
# File 'lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload.rb', line 23

def rule_name
  NAME
end