Multiple choice technology security

Which cookie value or attribute helps protect session tokens from a cross-site scripting attack?

  1. HTTP-ONLY is set

  2. Domain is not set

  3. Expiration is set to one week

  4. Expiration is set to one day

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The HTTPOnly flag prevents client-side JavaScript from accessing the cookie value, which protects session tokens from being stolen via XSS attacks. Setting expiration duration only affects when the cookie expires, while the domain attribute controls cookie scope - neither directly protects against XSS.