Java SE 7 Programmer II — Question 6

Which two measures are most effective in protecting websites from cross site scripting (XSS) attacks?

Answer options

Correct answer: C, E

Explanation

Option C is correct because ensuring that the session cookie is transmitted only over HTTPS protects it from being intercepted. Option E is also correct as running user-supplied scripts in a server-side sandbox mitigates the risk of XSS attacks by preventing execution in the client's browser. Options A, B, and D are relevant to XSS prevention but do not directly address the most effective measures compared to C and E.