You Inversion of Control Framework Secure
You Inversion of Control Framework Secure
Front Controller
Source: /spring-framework-2.0.7/docs/MVC-step-by-step/
Time to wire up the app
Basic controller
Form view
Form controller
Model
Huh?
All this gives you…
I thought this was about security?
• “There does not now, nor will there ever, exist a programming language in which it
is the least bit hard to write bad programs.”
• Lawrence Flon
• “If there are two or more ways to do something, and one of those ways can result
in a disaster, then someone will do it.”
• Edward A Murphy
• Note that there are potential security implications in failing to set an array of
allowed fields. In the case of HTTP form POST data, for example, malicious
clients can attempt to subvert an application by supplying values for fields or
properties that do not exist on the form. In some cases this could lead to
illegal data being set on command objects or their nested objects. For this
reason, it is highly recommended to specify the allowedFields property
on the DataBinder.
Source:
http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/validation/DataBinder.h
tml
Demo time
• Demo #1
But wait, it gets better
• Inversion of Control
MVC Recap
• DispatcherServlet
• The DispatcherServlet is the FrontController in the MVC pattern and is
responsible for controller routing.
• ModelAndView
• Created by the Controller
• Holds the Model
• Ties the View to the request
• ViewResolver
• Associates view names to view implementations
• HandlerMapping
• Used by the DispatcherServlet for request routing
Blah Blah Blah, I thought we covered
this already!
Did I say it’s all about the Model? Maybe it’s the View
• ViewResolver
• Provides a mapping between view names and actual
views.
• UrlBasesViewResolver
• Provides direct resolution between symbolic view names and
URLS.
• InternalResourceViewResolver
• Primarily used to route requests to internal JSPS/Servlets
• BeanNameViewResolver
• Basic resolver that maps views to beans in the current
application context.
• View resolvers can be chained, this could never
be a problem, right?
This can be a huge problem.
• Demo #2
So, what do you do?
• Happy Hunting :)
• http://www.google.com/codesearch?hl=en&lr=&q=ModelAndView
%5C%28.*request%5C.&sbtn=Search
Questions