Commit 520af0a8a47afb555228119748e68c5e93a8f37b
Committed by
Joenio Costa
1 parent
50c9c297
Exists in
staging
and in
42 other branches
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 | 118 | assert_no_match /script/, article.name |
| 119 | 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 | 126 | should 'notifiable be true' do |
| 122 | 127 | a = fast_create(TinyMceArticle) |
| 123 | 128 | assert a.notifiable? | ... | ... |