CompTIA CASP+ (CAS-003) — Question 264

A web developer has implemented HTML5 optimizations into a legacy web application. One of the modifications the web developer made was the following client side optimization: localStorage.setItem(`session-cookie`, document.cookie);
Which of the following should the security engineer recommend?

Answer options

Correct answer: C

Explanation

The correct answer is C because scoping cookies to a relevant domain/path enhances security by limiting access to only the intended parts of the application. While options A, B, and D offer security improvements, they do not directly address the issue of cookie scope, which is crucial for preventing unauthorized access.