Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZBUG-1932: Upgrading owasp-java-html-sanitizer version #1227

Merged
merged 1 commit into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions store/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@
<ivy:install organisation="oauth" module="oauth" revision="1.4" settingsRef="dev.settings" from="chain-resolver" to="build-tmp" overwrite="true" transitive="true" type="jar"/>
<ivy:install organisation="org.apache.xmlgraphics" module="batik-css" revision="1.7" settingsRef="dev.settings" from="chain-resolver" to="build-tmp" overwrite="true" transitive="true" type="jar"/>
<ivy:install organisation="org.w3c.css" module="sac" revision="1.3" settingsRef="dev.settings" from="chain-resolver" to="build-tmp" overwrite="true" transitive="true" type="jar"/>
<ivy:install organisation="org.apache.xmlgraphics" module="batik-i18n" revision="1.9" settingsRef="dev.settings" from="chain-resolver" to="build-tmp" overwrite="true" transitive="true" type="jar"/>
<ivy:install organisation="org.apache.xmlgraphics" module="batik-util" revision="1.8" settingsRef="dev.settings" from="chain-resolver" to="build-tmp" overwrite="true" transitive="true" type="jar"/>
<ivy:install organisation="org.apache.xmlgraphics" module="batik-i18n" revision="1.14" settingsRef="dev.settings" from="chain-resolver" to="build-tmp" overwrite="true" transitive="true" type="jar"/>
<ivy:install organisation="org.apache.xmlgraphics" module="batik-util" revision="1.14" settingsRef="dev.settings" from="chain-resolver" to="build-tmp" overwrite="true" transitive="true" type="jar"/>
<ivy:install organisation="org.springframework" module="spring-aop" revision="5.1.10.RELEASE" settingsRef="dev.settings" from="chain-resolver" to="build-tmp" overwrite="true" transitive="true" type="jar"/>
<ivy:install organisation="org.springframework" module="spring-beans" revision="5.1.10.RELEASE" settingsRef="dev.settings" from="chain-resolver" to="build-tmp" overwrite="true" transitive="true" type="jar"/>
<ivy:install organisation="org.springframework" module="spring-context" revision="5.1.10.RELEASE" settingsRef="dev.settings" from="chain-resolver" to="build-tmp" overwrite="true" transitive="true" type="jar"/>
Expand Down
4 changes: 3 additions & 1 deletion store/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<dependency org="com.101tec" name="zkclient" rev="0.1.0"/>
<dependency org="xerces" name="xercesImpl" rev="2.9.1-patch-01"/>
<dependency org="net.sourceforge.nekohtml" name="nekohtml" rev="1.9.13.1z"/>
<dependency org="com.googlecode.owasp-java-html-sanitizer" name="owasp-java-html-sanitizer" rev="20190610.3z"/>
<dependency org="com.googlecode.owasp-java-html-sanitizer" name="owasp-java-html-sanitizer" rev="20190610.4z"/>
<dependency org="org.ehcache" name="ehcache" rev="3.1.2"/>
<dependency org="ant-1.7.0-ziputil-patched" name="ant-1.7.0-ziputil-patched" rev="1.0"/>
<dependency org="org.eclipse.jetty" name="jetty-continuation" rev="${jetty.version}"/>
Expand Down Expand Up @@ -138,5 +138,7 @@
<dependency org="org.tukaani" name="xz" rev="1.9"/>
<dependency org="com.drewnoakes" name="metadata-extractor" rev="2.16.0"/>
<dependency org="com.adobe.xmp" name="xmpcore" rev="6.1.11"/>
<dependency org="org.apache.xmlgraphics" name="batik-i18n" rev="1.14"/>
<dependency org="org.apache.xmlgraphics" name="batik-util" rev="1.14"/>
</dependencies>
</ivy-module>
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.zimbra.cs.mime.ParsedMessage;
import com.zimbra.cs.servlet.ZThreadLocal;
import com.zimbra.cs.util.ZTestWatchman;
import org.owasp.html.Encoding;

public class OwaspHtmlSanitizerTest {

Expand Down Expand Up @@ -731,4 +732,31 @@ public void testBugZCS10594() throws Exception {
String output = "<html><head><style>.uegzbq{font-size:22px;}@media not all and (pointer:coarse){.8bsfb:hover{background-color:#056b27;}}.scem3j{font-size:25px;}</style></head><body><div class=\"uegzbq\">First Line</div><br /><div class=\"scem3j\">Second Line</div></body></html>";
Assert.assertTrue("Verification failed: Failed to include media queries.", output.equals(result.trim()));
}

@Test
public void testBug1932ShouldReturnSameUrlAfterSanitizing_1() throws Exception {
String url = "https://google.com/?page=red.blue&num_ar=abcd123456&orgAcronyme=abc12";
String html = "<a href='"+url+"'>"+url+"</a>";
String result = new OwaspHtmlSanitizer(html, true, null).sanitize();
//&num should not be converted to #
Assert.assertTrue(Encoding.decodeHtml(result).contains(url));
}

@Test
public void testBug1932ShouldReturnSameUrlAfterSanitizing_2() throws Exception {
String url = "https://google.com/?page=red.blue&numero_num=10&Integral_int=20";
String html = "<a href='"+url+"'>"+url+"</a>";
String result = new OwaspHtmlSanitizer(html, true, null).sanitize();
//&numero and &Integral should not be converted to № and ∫
Assert.assertTrue(Encoding.decodeHtml(result).contains(url));
}

@Test
public void testBug1932ShouldReturnSameUrlAfterSanitizing_3() throws Exception {
String url = "https://google.com/?account=2&order_id=125";
String html = "<a href='"+url+"'>"+url+"</a>";
String result = new OwaspHtmlSanitizer(html, true, null).sanitize();
//&order should not be converted to ℴ
Assert.assertTrue(Encoding.decodeHtml(result).contains(url));
}
}