class TaintedLove::Replacer::ReplaceObject

Constants

TAGS

Public Instance Methods

replace!() click to toggle source
# File lib/tainted_love/replacer/replace_object.rb, line 8
def replace!
  mod = Module.new do
    def send(*args, &block)
      if args[0].tainted? && args[1].tainted?
        TaintedLove.report(
          :ReplaceObject,
          args.first,
          [:rce],
          'User input in the first 2 arguments of Object#send'
        )
      end

      super(*args, &block)
    end

    def tainted_love_tags
      TAGS[object_id] ||= []
    end

    def tainted_love_tags=(tags)
      TAGS[object_id] = tags
    end
  end

  Object.prepend(mod)
end
send(*args, &block) click to toggle source
Calls superclass method
# File lib/tainted_love/replacer/replace_object.rb, line 10
def send(*args, &block)
  if args[0].tainted? && args[1].tainted?
    TaintedLove.report(
      :ReplaceObject,
      args.first,
      [:rce],
      'User input in the first 2 arguments of Object#send'
    )
  end

  super(*args, &block)
end
tainted_love_tags() click to toggle source
# File lib/tainted_love/replacer/replace_object.rb, line 23
def tainted_love_tags
  TAGS[object_id] ||= []
end
tainted_love_tags=(tags) click to toggle source
# File lib/tainted_love/replacer/replace_object.rb, line 27
def tainted_love_tags=(tags)
  TAGS[object_id] = tags
end