Results 1 to 4 of 4
- 11-23-2011, 10:40 AM #1
Member
- Join Date
- Sep 2011
- Posts
- 5
- Rep Power
- 0
Preventing XSS but allowing certain characters like apostrophe,!,"
My project is on J2EE(JSp/Servlets). It is IDM enabled. Recently they have updated their security policies to prevent XSS which is not allowing me to enter apostrophe in text box and submit.How t allow certain characters to be entered but at the same time it should prevent XSS.
- 11-23-2011, 06:55 PM #2
Re: Preventing XSS but allowing certain characters like apostrophe,!,"
Don't double post. The other thread you started in the New to Java section has been removed.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-02-2012, 05:03 AM #3
Member
- Join Date
- Nov 2010
- Posts
- 44
- Rep Power
- 0
Re: Preventing XSS but allowing certain characters like apostrophe,!,"
There are multiple approaches to this:
1) Find the flows that are exceptional cases and treat them with a different regex expression, instead of a blanket approach.
2) Using a filter, instead of disallowing the input, convert it to its corresponding html code (e.g. < for less-then symbol) - this is what i have used in past and it works quite well
3) Most XSS happen due to ability to insert a tag with open and close tag. Checking for those and handling those will prevent majority of XSS attacks instead of having a blanket approach to filter apostrophe, or double quotes, or pound symbol, etc. as those can be validate user inputs.
HTH.
- 02-02-2012, 09:50 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Similar Threads
-
Regular expression for alphanumeric characters containing space ,"_" and "-"
By dpkcv in forum Advanced JavaReplies: 2Last Post: 10-03-2011, 06:22 PM -
Allowing only hex values in a textfield
By elsanthosh in forum AWT / SwingReplies: 3Last Post: 07-20-2010, 09:31 AM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM -
make apostrophe differable in an sql request
By bachtoutou in forum New To JavaReplies: 1Last Post: 05-20-2008, 02:21 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks