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

Add test for select vulnerability in Rails 3

上级 05a6ff6b
<h1>Editing user</h1> <h1>Editing user</h1>
<%= select('post', 'author_id', "<option value='#{@user.id}'>#{@user.name}</option>") %>
<%= render 'form' %> <%= render 'form' %>
<%= link_to 'Show', @user %> | <%= link_to 'Show', @user %> |
......
...@@ -13,7 +13,7 @@ class Rails31Tests < Test::Unit::TestCase ...@@ -13,7 +13,7 @@ class Rails31Tests < Test::Unit::TestCase
def expected def expected
@expected ||= { @expected ||= {
:model => 0, :model => 0,
:template => 0, :template => 1,
:controller => 1, :controller => 1,
:warning => 7 } :warning => 7 }
end end
...@@ -97,4 +97,13 @@ class Rails31Tests < Test::Unit::TestCase ...@@ -97,4 +97,13 @@ class Rails31Tests < Test::Unit::TestCase
:confidence => 1, :confidence => 1,
:file => /user\.rb/ :file => /user\.rb/
end end
def test_select_vulnerability
assert_warning :type => :template,
:warning_type => "Cross Site Scripting",
:line => 2,
:message => /^Upgrade to Rails 3.1.4, 3.1.0 select\(\) helper is vulnerable/,
:confidence => 0,
:file => /edit\.html\.erb/
end
end end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册