aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorManu <manu.1982@gmail.com>2012-01-12 16:13:26 +0530
committerManu <manu.1982@gmail.com>2012-01-12 16:13:26 +0530
commite7e4deec117154d34db1b18341c00c497e65e089 (patch)
treeed2e1c9d19201cd4894d7601c726e4be5c2d0b2a /actionpack/test
parent838d30f182b1fa0cabd977e98fc47b4adb2064e4 (diff)
downloadrails-e7e4deec117154d34db1b18341c00c497e65e089.tar.gz
rails-e7e4deec117154d34db1b18341c00c497e65e089.tar.bz2
rails-e7e4deec117154d34db1b18341c00c497e65e089.zip
Handle leading spaces in protocol while sanitizing
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/html-scanner/sanitizer_test.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/test/template/html-scanner/sanitizer_test.rb b/actionpack/test/template/html-scanner/sanitizer_test.rb
index 62ad6be680..b4d751e405 100644
--- a/actionpack/test/template/html-scanner/sanitizer_test.rb
+++ b/actionpack/test/template/html-scanner/sanitizer_test.rb
@@ -138,7 +138,7 @@ class SanitizerTest < ActionController::TestCase
assert sanitizer.send(:contains_bad_protocols?, 'src', "#{proto}://bad")
end
end
-
+
def test_should_accept_good_protocols_ignoring_case
sanitizer = HTML::WhiteListSanitizer.new
HTML::WhiteListSanitizer.allowed_protocols.each do |proto|
@@ -146,6 +146,13 @@ class SanitizerTest < ActionController::TestCase
end
end
+ def test_should_accept_good_protocols_ignoring_space
+ sanitizer = HTML::WhiteListSanitizer.new
+ HTML::WhiteListSanitizer.allowed_protocols.each do |proto|
+ assert !sanitizer.send(:contains_bad_protocols?, 'src', " #{proto}://good")
+ end
+ end
+
def test_should_accept_good_protocols
sanitizer = HTML::WhiteListSanitizer.new
HTML::WhiteListSanitizer.allowed_protocols.each do |proto|