Sha256: a296fd17d8d53840733d6ac7b8b39d5c8b9faad07fe3e32837109066f3b6252b

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

module TaintedLove
  # Replacer will replace methods to report tainted input and taint values from user input coming
  # from librairies.
  module Replacer
    class Base
      # Determines if the replacer can run in the current context. This would usually check Ruby
      # version or gem versions to see which classes and methods to replace.
      def should_replace?
        true
      end

      # List of defined replacers
      #
      # @return [Array<Class>]
      def self.replacers
        replacers = TaintedLove::Replacer.constants.map do |const|
          cls = TaintedLove::Replacer.const_get(const)
          cls if cls.method_defined?(:replace!)
        end.compact

        replacers -= [TaintedLove::Replacer::ReplaceObject]

        [TaintedLove::Replacer::ReplaceObject] + replacers
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tainted_love-0.4.1 lib/tainted_love/replacer/base.rb
tainted_love-0.4.0 lib/tainted_love/replacer/base.rb