Module: Contrast::Agent::Assess::Policy::TriggerValidation

Defined in:
lib/contrast/agent/assess/policy/trigger_validation/trigger_validation.rb,
lib/contrast/agent/assess/policy/trigger_validation/xss_validator.rb,
lib/contrast/agent/assess/policy/trigger_validation/ssrf_validator.rb,
lib/contrast/agent/assess/policy/trigger_validation/redos_validator.rb

Overview

Some of our triggers require transformation or validation prior to reporting in order to account for false positives or other aberrant conditions. This provides a single place from which those validations can be called.

Defined Under Namespace

Modules: REDOSValidator, SSRFValidator, XSSValidator

Constant Summary collapse

VALIDATORS =
[
  Contrast::Agent::Assess::Policy::TriggerValidation::SSRFValidator,
  Contrast::Agent::Assess::Policy::TriggerValidation::XSSValidator,
  Contrast::Agent::Assess::Policy::TriggerValidation::REDOSValidator
].cs__freeze

Class Method Summary collapse

Class Method Details

.valid?(patcher, object, ret, args) ⇒ Boolean

Determines if the conditions in which this trigger was called are valid and should result in the generation of a Contrast::Api::Dtm::Finding.

Parameters:

Returns:

  • (Boolean)

    if the conditions are valid for the generation of a Contrast::Api::Dtm::Finding



36
37
38
39
40
41
# File 'lib/contrast/agent/assess/policy/trigger_validation/trigger_validation.rb', line 36

def self.valid? patcher, object, ret, args
  specific_validator = VALIDATORS.find { |validator| validator::RULE_NAME == patcher&.rule_id }
  return specific_validator.valid?(patcher, object, ret, args) if specific_validator

  true
end