Skip to content

Commit

Permalink
Add tests for bang comments case
Browse files Browse the repository at this point in the history
  • Loading branch information
spassarop committed Jan 2, 2024
1 parent 61ac724 commit 295c5a3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions OWASP.AntiSamyTests/Html/AntiSamyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -982,5 +982,13 @@ public void TestRegexStackOverflow()
}
result.Should().NotBeNull();
}

[Test]
public void TestBangCommentWhenPreservingComments()
{
Policy revised = policy.CloneWithDirective(Constants.PRESERVE_COMMENTS, "true");
antisamy.Scan("<!--<div/>--!><img src=x onerror=mxss(1)> <li>--></p>", revised).GetCleanHtml().Should().NotContain("mxss");
antisamy.Scan("<!--<div/>--><img src=x onerror=mxss(1)> <li>--></p><input/>", revised).GetCleanHtml().Should().NotContain("mxss");
}
}
}

0 comments on commit 295c5a3

Please sign in to comment.