Module: Contrast::Agent::Assess::Policy::SourceValidation

Defined in:
lib/contrast/agent/assess/policy/source_validation/source_validation.rb,
lib/contrast/agent/assess/policy/source_validation/cross_site_validator.rb

Overview

Some of our sources require validation to prevent them from applying certain tags in a given context. This provides a single place from which those validations can be called.

Defined Under Namespace

Modules: CrossSiteValidator

Constant Summary collapse

VALIDATORS =
[Contrast::Agent::Assess::Policy::SourceValidation::CrossSiteValidator].cs__freeze

Class Method Summary collapse

Class Method Details

.valid?(tag, source_type, source_name) ⇒ Boolean

Determines if the conditions in which this source was called are valid and should result in the application of a tag

Parameters:

  • tag (String)

    the tag which the Source is attempting to apply

  • source_type (String)

    the type of the source

  • source_name (String)

    the name of the source

Returns:

  • (Boolean)

    if the conditions are valid for the application of a tag



24
25
26
27
28
29
# File 'lib/contrast/agent/assess/policy/source_validation/source_validation.rb', line 24

def self.valid? tag, source_type, source_name
  VALIDATORS.each do |validator|
    return false unless validator.valid?(tag, source_type, source_name)
  end
  true
end