Commit 520af0a8a47afb555228119748e68c5e93a8f37b

Authored by Antonio Terceiro
Committed by Joenio Costa
1 parent 50c9c297

Make sure TinyMCE's abstract is XSS-proof

The body is already extensively tested against XSS, and since both
abstract and body use the same validation I am only adding a new test
for the abstract to make sure it is being validated at all.
Showing 1 changed file with 5 additions and 0 deletions   Show diff stats
test/unit/tiny_mce_article_test.rb
@@ -118,6 +118,11 @@ class TinyMceArticleTest < Test::Unit::TestCase @@ -118,6 +118,11 @@ class TinyMceArticleTest < Test::Unit::TestCase
118 assert_no_match /script/, article.name 118 assert_no_match /script/, article.name
119 end 119 end
120 120
  121 + should 'not allow XSS on abstract' do
  122 + article = TinyMceArticle.create!(:name => "test 123", :abstract => 'abstract with <script>alert("xss")</script>', :profile => profile)
  123 + assert_no_match /script/, article.abstract
  124 + end
  125 +
121 should 'notifiable be true' do 126 should 'notifiable be true' do
122 a = fast_create(TinyMceArticle) 127 a = fast_create(TinyMceArticle)
123 assert a.notifiable? 128 assert a.notifiable?