diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-01 09:05:34 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-01 09:05:34 -0800 |
commit | c60c1c0812d5eb55e7024db350f8bc5b6729f7fe (patch) | |
tree | 8665043df7d6705bc5cc41daf59fc2041126ff41 /actionpack/test/template | |
parent | ecff25cda6917a07c7bcb4ed0865c75d16164306 (diff) | |
parent | 55ac1b9d889ddfdeaa3d6eb9389d3cc7695b8e07 (diff) | |
download | rails-c60c1c0812d5eb55e7024db350f8bc5b6729f7fe.tar.gz rails-c60c1c0812d5eb55e7024db350f8bc5b6729f7fe.tar.bz2 rails-c60c1c0812d5eb55e7024db350f8bc5b6729f7fe.zip |
Merge branch '3-2-stable-security' into 3-2-2
* 3-2-stable-security:
Ensure [] respects the status of the buffer.
delete vulnerable AS::SafeBuffer#[]
use AS::SafeBuffer#clone_empty for flushing the output_buffer
add AS::SafeBuffer#clone_empty
fix output safety issue with select options
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/form_options_helper_test.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index 62ab208c2e..5b19bcf0f9 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -495,7 +495,7 @@ class FormOptionsHelperTest < ActionView::TestCase def test_select_under_fields_for_with_string_and_given_prompt @post = Post.new - options = "<option value=\"abe\">abe</option><option value=\"mus\">mus</option><option value=\"hest\">hest</option>" + options = "<option value=\"abe\">abe</option><option value=\"mus\">mus</option><option value=\"hest\">hest</option>".html_safe output_buffer = fields_for :post, @post do |f| concat f.select(:category, options, :prompt => 'The prompt') @@ -651,6 +651,13 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_select_escapes_options + assert_dom_equal( + '<select id="post_title" name="post[title]"><script>alert(1)</script></select>', + select('post', 'title', '<script>alert(1)</script>') + ) + end + def test_select_with_selected_nil @post = Post.new @post.category = "<mus>" |