# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/agent/assess/policy/source_validation/cross_site_validator' module Contrast module Agent module Assess module Policy # 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. module SourceValidation VALIDATORS = [ Contrast::Agent::Assess::Policy::SourceValidation::CrossSiteValidator ].cs__freeze # Determines if the conditions in which this source was called are # valid and should result in the application of a tag # # @param tag [String] the tag which the Source is attempting to apply # @param source_type [String] the type of the source # @param source_name [String] the name of the source # @return [Boolean] if the conditions are valid for the application # of a tag 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 end end end end end