From 1add18a57b100dda47b10f1b136281b57ad39ac5 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 10 Jan 2013 13:23:11 +1100 Subject: [PATCH] 397535 Support pluggable alias checking to support symbolic links --- .../jsp/JspAndDefaultWithAliasesTest.java | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/JspAndDefaultWithAliasesTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/JspAndDefaultWithAliasesTest.java index 301141ac1c6..4cda7b4f864 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/JspAndDefaultWithAliasesTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/JspAndDefaultWithAliasesTest.java @@ -53,7 +53,6 @@ import org.junit.runners.Parameterized.Parameters; * Test various paths for JSP resources that tickle various java.io.File bugs to get around the JspServlet matching, that then flows to the DefaultServlet to be * served as source files. */ -@Ignore("Disabled till greg can look at it") @RunWith(Parameterized.class) public class JspAndDefaultWithAliasesTest { @@ -67,14 +66,14 @@ public class JspAndDefaultWithAliasesTest List data = new ArrayList(); // @formatter:off - data.add(new String[] { "/dump.jsp" }); - data.add(new String[] { "/dump.jsp%00" }); - data.add(new String[] { "/dump.jsp%00x" }); - data.add(new String[] { "/dump.jsp%00/" }); - data.add(new String[] { "/dump.jsp%00x/" }); - data.add(new String[] { "/dump.jsp%00x/dump.jsp" }); - data.add(new String[] { "/dump.jsp%00/dump.jsp" }); - data.add(new String[] { "/dump.jsp%00/index.html" }); + data.add(new String[] { "false","/dump.jsp" }); + data.add(new String[] { "true", "/dump.jsp%00" }); + data.add(new String[] { "false","/dump.jsp%00x" }); + data.add(new String[] { "false","/dump.jsp%00/" }); + data.add(new String[] { "false","/dump.jsp%00x/" }); + data.add(new String[] { "false","/dump.jsp%00x/dump.jsp" }); + data.add(new String[] { "false","/dump.jsp%00/dump.jsp" }); + data.add(new String[] { "false","/dump.jsp%00/index.html" }); // @formatter:on return data; @@ -125,11 +124,13 @@ public class JspAndDefaultWithAliasesTest } private String path; + private boolean knownBypass; - public JspAndDefaultWithAliasesTest(String encodedRequestPath) + public JspAndDefaultWithAliasesTest(String bypassed, String encodedRequestPath) { LOG.info("Path \"" + encodedRequestPath + "\""); this.path = encodedRequestPath; + this.knownBypass= Boolean.parseBoolean(bypassed); } private void assertProcessedByJspServlet(HttpURLConnection conn) throws IOException @@ -137,8 +138,14 @@ public class JspAndDefaultWithAliasesTest // make sure that jsp actually ran, and didn't just get passed onto // the default servlet to return the jsp source String body = getResponseBody(conn); - Assert.assertThat("Body",body,not(containsString("<%@"))); - Assert.assertThat("Body",body,not(containsString("=0) + LOG.info("Known bypass of mapping by "+path); + else + { + Assert.assertThat("Body",body,not(containsString("<%@"))); + Assert.assertThat("Body",body,not(containsString("