Sha256: 93456e4e6c2dd0c629798c56295f4a68da61973d32ae223d53cf63283b7bd626

Contents?: true

Size: 1.36 KB

Versions: 11

Compression:

Stored size: 1.36 KB

Contents

# 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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
contrast-agent-4.4.1 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.4.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.3.2 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.3.1 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.3.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.2.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.1.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-4.0.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-3.16.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-3.15.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb
contrast-agent-3.14.0 lib/contrast/agent/assess/policy/source_validation/source_validation.rb