提交 92765681 编写于 作者: J Justin Collins

Add test for class_eval false positive

when target is a model
上级 61ff1878
......@@ -8,4 +8,11 @@ class Account < ActiveRecord::Base
def mass_assign_it
Account.new(params[:account_info]).some_other_method
end
def test_class_eval
#Should not raise a warning
User.class_eval do
attr_reader :some_private_thing
end
end
end
......@@ -32,6 +32,15 @@ class Rails3Tests < Test::Unit::TestCase
:file => /home_controller\.rb/
end
def test_class_eval_false_positive
assert_no_warning :type => :warning,
:warning_type => "Dangerous Eval",
:line => 13,
:message => /^User input in eval/,
:confidence => 0,
:file => /account\.rb/
end
def test_command_injection_params_interpolation
assert_warning :type => :warning,
:warning_type => "Command Injection",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册