Sha256: dbe2831db6bcfe58ff60e15074eb3b522a2dbbdf209f8997868f175a83fdf106

Contents?: true

Size: 1.25 KB

Versions: 11

Compression:

Stored size: 1.25 KB

Contents

# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

module Contrast
  module Agent
    module Assess
      module Policy
        module Propagator
          # A propagator is a method which can transform data, as described by
          # the Contrast::Agent::Assess::Policy::PropagationNode class. Each
          # type of propagator does so differently, but always acts on a Source
          # to pass tags from it to a Target.
          class Base
            class << self
              def find_source source, preshift
                case source
                when Contrast::Utils::ObjectShare::OBJECT_KEY
                  preshift.object
                else
                  preshift.args[source]
                end
              end

              def tracked_value? value
                Contrast::Utils::DuckUtils.quacks_to?(value, :cs__tracked?) && value.cs__tracked?
              end

              def propagate _propagation_node, _preshift, _target
                raise NotImplementedError("Expected Base propagator subclass: #{ cs__class } to implement #propagate")
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
contrast-agent-3.12.2 lib/contrast/agent/assess/policy/propagator/base.rb
contrast-agent-3.12.1 lib/contrast/agent/assess/policy/propagator/base.rb
contrast-agent-3.12.0 lib/contrast/agent/assess/policy/propagator/base.rb
contrast-agent-3.11.0 lib/contrast/agent/assess/policy/propagator/base.rb
contrast-agent-3.10.2 lib/contrast/agent/assess/policy/propagator/base.rb
contrast-agent-3.10.1 lib/contrast/agent/assess/policy/propagator/base.rb
contrast-agent-3.10.0 lib/contrast/agent/assess/policy/propagator/base.rb
contrast-agent-3.9.1 lib/contrast/agent/assess/policy/propagator/base.rb
contrast-agent-3.9.0 lib/contrast/agent/assess/policy/propagator/base.rb
contrast-agent-3.8.5 lib/contrast/agent/assess/policy/propagator/base.rb
contrast-agent-3.8.4 lib/contrast/agent/assess/policy/propagator/base.rb