提交 2be9d050 编写于 作者: O oreoshake

Add a test case where auto-escaping is turned on

上级 fcc40b1a
......@@ -125,4 +125,8 @@ class UsersController < ApplicationController
def results
@users = User.all(:conditions => "display_name like '%#{params[:query]}%'")
end
def to_json
end
end
<%= raw({:asdf => params[:asdf]}.to_json) %>
\ No newline at end of file
......@@ -10,7 +10,7 @@ class RailsWithXssPluginTests < Test::Unit::TestCase
@expected ||= {
:controller => 1,
:model => 3,
:template => 1,
:template => 2,
:warning => 14 }
end
......@@ -257,4 +257,13 @@ class RailsWithXssPluginTests < Test::Unit::TestCase
:confidence => 0,
:file => /Gemfile/
end
def test_to_json
assert_warning :type => :template,
:warning_type => "Cross Site Scripting",
:line => 1,
:message => /^Unescaped parameter value in JSON hash/,
:confidence => 0,
:file => /users\/to_json\.html\.erb/
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册