Class: Contrast::Agent::Reporting::Settings::Exclusions

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/agent/reporting/settings/exclusions.rb

Overview

Application level settings for the Exclusions featureset (ApplicationStartupSettingsExclusions)

Instance Method Summary collapse

Instance Method Details

#input_exclusionsObject

Cases where rules should be excluded if violated from a given input.

Array of InputExclusions



20
21
22
# File 'lib/contrast/agent/reporting/settings/exclusions.rb', line 20

def input_exclusions
  @_input_exclusions ||= []
end

#input_exclusions=(new_input_exclusions) ⇒ Object

set the InputExclusions array. Pass boolean flag as end element of array for ng endpoint. example: input_exclusions = [array, boolean]

} Array of InputExclusions

Parameters:

  • new_input_exclusions (Array<InputExclusions>)

    Array of InputExclusions: { name [String] The name of the input. modes [String] If this exclusion applies to assess or protect. [assess, defend] assess_rules [Array] Array of assess rules to which this exclusion applies. AssessRuleID [String] protect_rules [Array] Array of ProtectRuleID [String] The protect rules to which this exclusion applies. urls [Array] Array of URLs to which the exclusions apply. URL [String] match_strategy [String] If this exclusion applies to all URLs or only those specified. [ALL, ONLY] type [String] The type of the input [COOKIE, PARAMETER, HEADER, BODY, QUERYSTRING]



38
39
40
41
42
43
44
45
46
# File 'lib/contrast/agent/reporting/settings/exclusions.rb', line 38

def input_exclusions= new_input_exclusions
  # The ng_endpoint check is passed as boolean parameter in the setter method. We need to check and see
  # if it is set:
  @_input_exclusions = Contrast::Agent::Reporting::Settings::Helpers.array_to_iv(
      Contrast::Agent::Reporting::Settings::InputExclusion,
      input_exclusions,
      new_input_exclusions,
      ng_endpoint: new_input_exclusions[-1] == !!new_input_exclusions[-1])
end

#to_controlled_hashObject



76
77
78
79
80
81
# File 'lib/contrast/agent/reporting/settings/exclusions.rb', line 76

def to_controlled_hash
  {
      inputExceptions: input_exclusions.map(&:to_controlled_hash),
      urlExceptions: url_exclusions.map(&:to_controlled_hash)
  }
end

#url_exclusionsObject

A case where rules should be excluded if violated during a call to a given URL.



51
52
53
# File 'lib/contrast/agent/reporting/settings/exclusions.rb', line 51

def url_exclusions
  @_url_exclusions ||= []
end

#url_exclusions=(new_url_exclusions) ⇒ Object

set the url_exclusions array. Pass boolean flag as end element of array for ng endpoint. example: url_exclusions = [array, boolean]

}

Parameters:

  • new_url_exclusions (Array)

    Array of UrlExclusions: { name [String] The name of the input. modes [String] If this exclusion applies to assess or protect. [assess, defend] assess_rules [Array] Array of assess rules to which this exclusion applies. AssessRuleID [String] protect_rules [Array] Array of ProtectRuleID [String] The protect rules to which this exclusion applies. urls [Array] Array of URLs to which the exclusions apply. URL [String] match_strategy [String] If this exclusion applies to all URLs or only those specified. [ALL, ONLY] type [String] The type of the input [COOKIE, PARAMETER, HEADER, BODY, QUERYSTRING]



68
69
70
71
72
73
74
# File 'lib/contrast/agent/reporting/settings/exclusions.rb', line 68

def url_exclusions= new_url_exclusions
  @_url_exclusions = Contrast::Agent::Reporting::Settings::Helpers.array_to_iv(
      Contrast::Agent::Reporting::Settings::UrlExclusion,
      url_exclusions,
      new_url_exclusions,
      ng_endpoint: new_url_exclusions[-1] == !!new_url_exclusions[-1])
end