Sha256: 167dd1c4512b3b6707cdd2c3c3d37ebd6392889ef5fab06c9cdd0dc8ca7a6c75

Contents?: true

Size: 1.34 KB

Versions: 11

Compression:

Stored size: 1.34 KB

Contents

# Copyright (c) 2021 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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
contrast-agent-4.14.1 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.14.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.13.1 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.13.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.12.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.11.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.10.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.9.1 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.9.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.8.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.7.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb