From 167e998f6128f2a04170181030fceb21047f7b79 Mon Sep 17 00:00:00 2001 From: Timm Date: Wed, 3 Jul 2013 19:55:52 +0200 Subject: Removed the contains_bad_protocols? method as well as the tests for it. Loofah already deals with this. --- actionview/test/template/sanitizers_test.rb | 33 ----------------------------- 1 file changed, 33 deletions(-) (limited to 'actionview/test/template/sanitizers_test.rb') diff --git a/actionview/test/template/sanitizers_test.rb b/actionview/test/template/sanitizers_test.rb index dc2fcf61e8..3a2d95fc87 100644 --- a/actionview/test/template/sanitizers_test.rb +++ b/actionview/test/template/sanitizers_test.rb @@ -149,39 +149,6 @@ class SanitizerTest < ActionController::TestCase end end - def test_should_flag_bad_protocols - sanitizer = ActionView::WhiteListSanitizer.new - %w(about chrome data disk hcp help javascript livescript lynxcgi lynxexec ms-help ms-its mhtml mocha opera res resource shell vbscript view-source vnd.ms.radio wysiwyg).each do |proto| - assert sanitizer.send(:contains_bad_protocols?, 'src', "#{proto}://bad") - end - end - - def test_should_accept_good_protocols_ignoring_case - sanitizer = ActionView::WhiteListSanitizer.new - ActionView::WhiteListSanitizer.allowed_protocols.each do |proto| - assert !sanitizer.send(:contains_bad_protocols?, 'src', "#{proto.capitalize}://good") - end - end - - def test_should_accept_good_protocols_ignoring_space - sanitizer = ActionView::WhiteListSanitizer.new - ActionView::WhiteListSanitizer.allowed_protocols.each do |proto| - assert !sanitizer.send(:contains_bad_protocols?, 'src', " #{proto}://good") - end - end - - def test_should_accept_good_protocols - sanitizer = ActionView::WhiteListSanitizer.new - ActionView::WhiteListSanitizer.allowed_protocols.each do |proto| - assert !sanitizer.send(:contains_bad_protocols?, 'src', "#{proto}://good") - end - end - - def test_should_reject_hex_codes_in_protocol - assert_sanitized %(1), "1" - assert @sanitizer.send(:contains_bad_protocols?, 'src', "%6A%61%76%61%73%63%72%69%70%74%3A%61%6C%65%72%74%28%22%58%53%53%22%29") - end - def test_should_block_script_tag assert_sanitized %(), "" end -- cgit v1.2.3