提交 1fe36bc4 编写于 作者: J Justin

Merge pull request #315 from presidentbeef/deal_with_controller_inside_class

Only treat controllers like controllers
......@@ -24,6 +24,12 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
def process_class exp
name = class_name(exp.class_name)
if not name.to_s.match(/Controller$/)
#Skip classes that are not controllers, but treat as a module because
#a class that is not a controller might contain a controller
return process_module exp
end
if @controller
Brakeman.debug "[Notice] Skipping inner class: #{name}"
return ignore
......
class Whatever
module Wherever
class NestedController < ApplicationController
def so_nested
@bad_thing = params[:x]
end
end
end
end
......@@ -14,7 +14,7 @@ class Rails3Tests < Test::Unit::TestCase
@expected ||= {
:controller => 1,
:model => 8,
:template => 36,
:template => 37,
:warning => 53
}
......@@ -824,6 +824,16 @@ class Rails3Tests < Test::Unit::TestCase
:file => /test_params\.html\.erb/
end
def test_cross_site_scripting_in_nested_controller
assert_warning :type => :template,
:warning_code => 2,
:warning_type => "Cross Site Scripting",
:line => 1,
:message => /^Unescaped\ parameter\ value/,
:confidence => 0,
:file => /so_nested\.html\.erb/
end
def test_cross_site_scripting_select_tag_CVE_2012_3463
assert_warning :type => :template,
:warning_type => "Cross Site Scripting",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册