jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

Jetty-12 EE10 handling of %2F as Alias

Open gregw opened this issue 3 years ago • 3 comments

Jetty version(s) jetty-12 ee10

Description

The org.eclipse.jetty.ee10.webapp.WebAppContextTest#testProtectedTarget has some important use-cases commented out with regards to handling of %2F

gregw avatar Aug 15 '22 03:08 gregw

The new behaviour of servlet 6.0 allows a servletPath and/or pathInfo to contain a %2F as an encoded / character.

For example, a request to /WEB-INF%2Ftest.xml is currently resolving to a Resource with:

path=/home/gregwilkins/src/jetty-12/jetty-ee10/jetty-ee10-webapp/src/test/webapp/WEB-INF/test.xml
uri=file:/home/gregwilkins/src/jetty-12/jetty-ee10/jetty-ee10-webapp/src/test/webapp/WEB-INF%2Ftest.xml
alias=null

So this has been resolved incorrectly. Either the path should be for the (probably) non-existent WEB-INF%2Ftest.xml OR if it does resolve to WEB-INF/test.xml then is should be seen as an alias for that.

gregw avatar Aug 15 '22 03:08 gregw

Commit edba0c3 "fixes" this issue by fixing a big in URIUtil that prevented the resource from being seen as an alias. However, a real fix should involve allowing an encoded %2F to be used to select a resource that actually has an encoded / in the filename? So I'm leaving this open for now.

gregw avatar Aug 15 '22 04:08 gregw

Commit edba0c3 broke the org.eclipse.jetty.util.resource.FileSystemResourceTest.testAccessUniCodeFile test. Looking into it now.

joakime avatar Aug 15 '22 13:08 joakime

Closing, as we have plenty of test cases for this now in Jetty-12

joakime avatar Jan 25 '23 22:01 joakime