Class: TaintedLove::Replacer::ReplaceObject

Inherits:
Base
  • Object
show all
Defined in:
lib/tainted_love/replacer/replace_object.rb

Instance Method Summary collapse

Methods inherited from Base

replacers, #should_replace?

Instance Method Details

#replace!Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/tainted_love/replacer/replace_object.rb', line 6

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_tracking
      @tainted_love_tracking ||= []
    end
  end

  Object.prepend(mod)
end