We help IT Professionals succeed at work.

Cross Site Scripting implementation

Hi All

There was some penetrating tests that was conducted in our existing production java application, and one of the recommendation is to address cross site scripting.

I need inputs from experts on implementing this cross side without the need make changes in every artifact

something like setting up some config file, etc if possible

Regards
Comment
Watch Question

Meir RivkinFull stack Software Engineer
BRONZE EXPERT
Commented:
i'd start with this link:
http://www.veracode.com/security/xss

the video by Chris Eng describes well what XSS means and ways to prevent it.

The following is taken from XSS Cheat Sheet from their website:
To prevent Cross-site Scripting vulnerabilities, you should URLEncode all user input that is returned as part of URLs. This will convert ?, &, /, <, >, and spaces to their respective URL encoded equals. Additionally, you should HTMLEncode all user input returned as part of HTML. This will also convert special characters into their respective HTML encoded equals. Last but not the least, you should convert all user input to a single character encoding before parsing. This applies to Single/Double Hex Encoding, Unicode Encoding, and UTF-8 Parsing.
In order to avoid Cross-site Scripting vulnerabilities, you can perform the following actions:
1. URLEncode all user input returned as part of URLs (convert ?, &, /, <, >, and spaces to their respective URL encoded equals).
2. HTMLEncode all user input returned as part of HTML.
3. Convert all user input to a single character encoding before parsing.

cheers
BRONZE EXPERT

Commented:
Use filter concept or interceptor concept .....

when all your request/response goes to filter or interceptor .. then you cant get the form values in the URL.  you can stop Corss Site scripting .
BRONZE EXPERT

Commented:
In Filter you can do set encoding or URLEncode.

Author

Commented:
Hi Dravid

could you share some reference or code fragments on this.

also I do not want to change in all my files. can you please explain a bit
Meir RivkinFull stack Software Engineer
BRONZE EXPERT
Commented:
BRONZE EXPERT
Commented:

Author

Commented:
Need to try

Explore More ContentExplore courses, solutions, and other research materials related to this topic.