aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-01-12 09:39:19 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-01-12 09:39:19 -0800
commitaa0f95559905e04026e5910876b3bb0d3271e9a4 (patch)
tree3117572c7b6b1eb22617acf951a7df54e2fd2cd7 /actionpack/test
parentdaf435d20ccdad86de400c4cfaacf54510c7ab6d (diff)
parente7e4deec117154d34db1b18341c00c497e65e089 (diff)
downloadrails-aa0f95559905e04026e5910876b3bb0d3271e9a4.tar.gz
rails-aa0f95559905e04026e5910876b3bb0d3271e9a4.tar.bz2
rails-aa0f95559905e04026e5910876b3bb0d3271e9a4.zip
Merge pull request #4419 from j-manu/4255-handle-spaces-in-protocols
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|