提交 2f8f55ce 编写于 作者: J Justin Collins

Add test for duplicate send() warnings

上级 d7f00569
......@@ -81,10 +81,10 @@ class HomeController < ApplicationController
def test_send_first_param
method = params["method"]
@result = User.send(method.to_sym)
do_something_with @result # don't warn on this line
end
# not that safe
def test_send_target
def test_send_target # not that safe
table = params["table"]
model = table.classify.constantize
@result = model.send(:method)
......
<%= h @result %> should not warn about send() because it warns in controller where it happens.
......@@ -855,6 +855,14 @@ class Rails2Tests < Test::Unit::TestCase
:file => /home_controller\.rb/,
:relative_path => "app/controllers/home_controller.rb"
assert_no_warning :type => :warning,
:warning_code => 23,
:warning_type => "Dangerous Send",
:line => 84,
:message => /^User\ controlled\ method\ execution/,
:confidence => 0,
:relative_path => "app/controllers/home_controller.rb"
assert_no_warning :type => :warning,
:warning_type => "Dangerous Send",
:line => 90,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册