Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Remove danger of using a request parameter in a JSP:include

843840Aug 8 2009 — edited Aug 10 2009
HI,
I have a basic include where the filename is controlled by a request parameter:
<%String fileName = request.getParameter("param1")+".jsp"; %>
<jsp:include page="<%=fileName%>" flush="true" />
This works fine but I am rather worried about the security as some can easily edit the URL to something like this:
http://www.mysite.com/include.jsp?param1=../../../passwords

Does anyone have any good security techniques that would strip out anything in param1 that could potentially be rather dangerous?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2009
Added on Aug 8 2009
1 comment
204 views