diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-11-02 07:41:12 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-11-02 07:41:12 +0000 |
commit | 6e68bf8ab4a06d4bc8eadda7d9bcbd8cf23476b5 (patch) | |
tree | 46e89688db13f58406d9e70c2635a5d9a390a25f | |
parent | d181a2221ac0c3d2b7a11fd91108a7243758f558 (diff) | |
download | redmine-6e68bf8ab4a06d4bc8eadda7d9bcbd8cf23476b5.tar.gz redmine-6e68bf8ab4a06d4bc8eadda7d9bcbd8cf23476b5.zip |
merge r7707 from trunk
add unit test of escaping image urls
Contributed by Holger Just.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@7709 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb index 9b7d62264..89e36224b 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -197,6 +197,13 @@ EXPECTED assert_equal '<p>[msg1][msg2]</p>', to_html('[msg1][msg2]') end + def test_textile_should_escape_image_urls + # this is onclick="alert('XSS');" in encoded form + raw = '!/images/comment.png"onclick=alert('XSS');"!' + expected = '<p><img src="/images/comment.png"onclick=&#x61;&#x6c;&#x65;&#x72;&#x74;&#x28;&#x27;&#x58;&#x53;&#x53;&#x27;&#x29;;&#x22;" alt="" /></p>' + assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '') + end + private def assert_html_output(to_test, expect_paragraph = true) |