My existing Spring Web MVC application has the following handler mapping in the Controller.
@RequestMapping(method = RequestMethod.GET, value = "/welcome")
I trigger the following requesthttp://www.example.com/welcomeand this works fine.
The problem is
http://www.example.com/welcome.check.blah
also works!!!
Also, a HTTP GET request URL to the application with script tag is getting redisplayed though it fails the authorization.
Example http://www.example.com/welcome<script>alert("hi")</script> gets redisplayed as such in the browser window and as a result of my authorization logic “Not authorized” message is displayed.
I wonder if this is a security issue and should I need do any encoding/filtering in the code?
This behavior is due to the option
useSuffixPatternMatchwhich is true by default inside theRequestMappingHandlerMapping(I assume you use Spring MVC 3.1).To set
useSuffixPatternMatchto false, the easiest way is to use@Configuration: