SPR-12354 applied new checks to make sure that served static resources
are under authorized locations.
Prior to this change, serving static resources from Servlet 3 locations
such as "/webjars/" would not work since those locations can be within
one of the JARs on path. In that case, the checkLocation method would
return false and disallow serving that static resource.
This change fixes this issue by making sure to call the
`ServletContextResource.getPath()` method for servlet context resources.
Note that there's a known workaround for this issue, which is using a
classpath scheme as location, such as:
"classpath:/META-INF/resources/webjars/" instead of "/webjars".
Issue: SPR-12432
(cherry picked from commit 161d3e3)
pull/710/head
Brian Clozel11 years agocommitted byJuergen Hoeller
@ -300,13 +301,17 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
@@ -300,13 +301,17 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
@ -317,7 +322,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
@@ -317,7 +322,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
returnfalse;
}
if(resourcePath.contains("%")){
// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 chars
// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 chars...