diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-01 09:56:04 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-01 09:56:04 -0800 |
commit | 139963c99a955520db6373343662e55f4d16dcd1 (patch) | |
tree | 56220dd9b09dc2341c6431784aa0f13d96d72743 /actionpack/test | |
parent | ceb66b61264657898cd6608c7e9ed78072169664 (diff) | |
parent | 8ccaa34103f1c37f7549f7f6c47a21dba21624db (diff) | |
download | rails-139963c99a955520db6373343662e55f4d16dcd1.tar.gz rails-139963c99a955520db6373343662e55f4d16dcd1.tar.bz2 rails-139963c99a955520db6373343662e55f4d16dcd1.zip |
Merge branch 'master-security'
* master-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
Conflicts:
actionpack/lib/action_view/helpers/tags/base.rb
Diffstat (limited to 'actionpack/test')
-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 6b8d62df62..606d454cb3 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -509,7 +509,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') @@ -665,6 +665,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>" |