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

Add tests for fake_filter -> before_filter

上级 ec8c6320
...@@ -2,4 +2,8 @@ class AnotherController < ApplicationController ...@@ -2,4 +2,8 @@ class AnotherController < ApplicationController
def overflow def overflow
@test = @test.where.all @test = @test.where.all
end end
before_filter do
eval params[:x]
end
end end
...@@ -16,7 +16,7 @@ class Rails4Tests < Test::Unit::TestCase ...@@ -16,7 +16,7 @@ class Rails4Tests < Test::Unit::TestCase
:controller => 0, :controller => 0,
:model => 1, :model => 1,
:template => 2, :template => 2,
:generic => 38 :generic => 39
} }
end end
...@@ -677,6 +677,19 @@ class Rails4Tests < Test::Unit::TestCase ...@@ -677,6 +677,19 @@ class Rails4Tests < Test::Unit::TestCase
:user_input => s(:call, s(:call, s(:params), :[], s(:lit, :email)), :[], s(:lit, :id)) :user_input => s(:call, s(:call, s(:params), :[], s(:lit, :email)), :[], s(:lit, :id))
end end
def test_before_filter_block
assert_warning :type => :warning,
:warning_code => 13,
:fingerprint => "f8081023e9a6026264eaee41a4a1f520fc98ee5dbcba2129245e6a3873cb6409",
:warning_type => "Dangerous Eval",
:line => 7,
:message => /^User\ input\ in\ eval/,
:confidence => 0,
:relative_path => "app/controllers/another_controller.rb",
:method => :before_filter,
:user_input => s(:call, s(:call, nil, :params), :[], s(:lit, :x))
end
#Verify checks external to Brakeman are loaded #Verify checks external to Brakeman are loaded
def test_external_checks def test_external_checks
assert defined? Brakeman::CheckExternalCheckTest assert defined? Brakeman::CheckExternalCheckTest
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册