Skip to content

Commit

Permalink
Closes #99: More iframe sanitizations
Browse files Browse the repository at this point in the history
  • Loading branch information
jendib committed Feb 20, 2016
1 parent 20fcbc5 commit c73556d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public String apply(String elementName, String attributeName, String value) {
"(http:|https:)?//(www.)?whyd.com/.+|" +
"(http:|https:)?//embed.spotify.com/.+|" +
"(http:|https:)?//www.kickstarter.com/.+|" +
"(http:|https:)?//cdn.livestream.com/embed/.+|" +
"(http:|https:)?//v.24liveblog.com/live/.+|" +
"(http:|https:)?//fiddle.jshell.net/.+|" +
"(http:|https:)?//soundsgood.co/embed/.+");

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ public void articleSanitizer99Test() throws Exception {
+ "<iframe src=\"//hitbox.tv/#!/embed/CymaticBruce\" width=\"480\" height=\"480\"></iframe>"
+ "<iframe src=\"//embed.spotify.com/?uri=spotify:album:3NNSJt3gWSmPmnjCwZyLA5\" width=\"480\" height=\"480\"></iframe>"
+ "<iframe src=\"//soundsgood.co/embed/5634c158722be1b60e7651be\" width=\"480\" height=\"480\"></iframe>"
+ "<iframe src=\"http://cdn.livestream.com/embed/spaceflightnow?layout=4&height=340&width=560&autoplay=false\" width=\"480\" height=\"480\"></iframe>"
+ "<iframe src=\"http://v.24liveblog.com/live/?id=1312491\" width=\"480\" height=\"480\"></iframe>"
+ "<iframe src=\"//fiddle.jshell.net/toddmotto/0oarywLe/show/light/\" width=\"480\" height=\"480\"></iframe>"
+ "<iframe src=\"//www.kickstarter.com/projects/223628811/the-airboard-sketch-internet-of-things-fast/widget/video.html\" width=\"480\" height=\"480\"></iframe>");
System.out.println(html);
Assert.assertTrue(html.contains("<iframe src=\"//www.deezer.com/plugins/player?autoplay&#61;false&amp;playlist&#61;true\" width=\"480\" height=\"480\"></iframe>"));
Expand All @@ -391,6 +394,9 @@ public void articleSanitizer99Test() throws Exception {
Assert.assertTrue(html.contains("<iframe src=\"//hitbox.tv/#!/embed/CymaticBruce\" width=\"480\" height=\"480\"></iframe>"));
Assert.assertTrue(html.contains("<iframe src=\"//embed.spotify.com/?uri&#61;spotify:album:3NNSJt3gWSmPmnjCwZyLA5\" width=\"480\" height=\"480\"></iframe>"));
Assert.assertTrue(html.contains("<iframe src=\"//soundsgood.co/embed/5634c158722be1b60e7651be\" width=\"480\" height=\"480\"></iframe>"));
Assert.assertTrue(html.contains("<iframe src=\"//cdn.livestream.com/embed/spaceflightnow?layout&#61;4&amp;height&#61;340&amp;width&#61;560&amp;autoplay&#61;false\" width=\"480\" height=\"480\"></iframe>"));
Assert.assertTrue(html.contains("<iframe src=\"//v.24liveblog.com/live/?id&#61;1312491\" width=\"480\" height=\"480\"></iframe>"));
Assert.assertTrue(html.contains("<iframe src=\"//fiddle.jshell.net/toddmotto/0oarywLe/show/light/\" width=\"480\" height=\"480\"></iframe>"));
Assert.assertTrue(html.contains("<iframe src=\"//www.kickstarter.com/projects/223628811/the-airboard-sketch-internet-of-things-fast/widget/video.html\" width=\"480\" height=\"480\"></iframe>"));
}
}

0 comments on commit c73556d

Please sign in to comment.