File tree Expand file tree Collapse file tree 4 files changed +27
-1
lines changed
main/java/io/undertow/servlet/handlers
test/java/io/undertow/servlet/test/defaultservlet Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ private Paths() {
3535 static boolean isForbidden (final String path ) {
3636 final StringTokenizer st = new StringTokenizer (path , "/\\ " , false );
3737 String subPath ;
38- while (st .hasMoreTokens ()) {
38+ if (st .hasMoreTokens ()) {
3939 subPath = st .nextToken ();
4040 if (META_INF .equalsIgnoreCase (subPath ) || WEB_INF .equalsIgnoreCase (subPath )) {
4141 return true ;
Original file line number Diff line number Diff line change @@ -273,6 +273,30 @@ public void testNoAccessToMetaInfResource() throws IOException {
273273 }
274274 }
275275
276+ @ Test
277+ public void testAccessToMetaInfSubDirResource () throws IOException {
278+ TestHttpClient client = new TestHttpClient ();
279+ try {
280+ HttpGet get = new HttpGet (DefaultServer .getDefaultServerURL () + "/servletContext/foo/meta-inf/notsecret" );
281+ HttpResponse result = client .execute (get );
282+ Assert .assertEquals (StatusCodes .OK , result .getStatusLine ().getStatusCode ());
283+ } finally {
284+ client .getConnectionManager ().shutdown ();
285+ }
286+ }
287+
288+ @ Test
289+ public void testAccessToWebInfSubDirResource () throws IOException {
290+ TestHttpClient client = new TestHttpClient ();
291+ try {
292+ HttpGet get = new HttpGet (DefaultServer .getDefaultServerURL () + "/servletContext/foo/web-inf/notsecret" );
293+ HttpResponse result = client .execute (get );
294+ Assert .assertEquals (StatusCodes .OK , result .getStatusLine ().getStatusCode ());
295+ } finally {
296+ client .getConnectionManager ().shutdown ();
297+ }
298+ }
299+
276300 @ Test
277301 public void testDirectoryListing () throws IOException {
278302 TestHttpClient client = new TestHttpClient ();
Original file line number Diff line number Diff line change 1+ not confidential
Original file line number Diff line number Diff line change 1+ not confidential
You can’t perform that action at this time.
0 commit comments