88.4k views
1 vote
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", );

Which of the following should the security engineer recommend?

A. SessionStorage should be used so authorized cookies expire after the session ends
B. Cookies should be marked as "secure" and "HttpOnly"
C. Cookies should be scoped to a relevant domain/path
D. Client-side cookies should be replaced by server-side mechanisms

1 Answer

4 votes

Final answer:

The security engineer should recommend marking the cookies as 'secure' and 'HttpOnly' to enhance security in the web application. Other recommendations include using SessionStorage, scoping cookies to a relevant domain/path, and replacing client-side cookies with server-side mechanisms.

Step-by-step explanation:

The security engineer should recommend option B: Cookies should be marked as 'secure' and 'HttpOnly'. When a web developer implements HTML5 optimizations and modifies client-side storage, it is important to ensure that sensitive data, such as cookies, are protected. By marking the cookies as 'secure', the web application ensures that they are only transmitted over HTTPS, a secure protocol. Additionally, marking the cookies as 'HttpOnly' prevents them from being accessed by client-side scripts, reducing the risk of cross-site scripting (XSS) attacks.

Option A, using SessionStorage, could be a valid recommendation depending on the specific requirements of the web application. SessionStorage would ensure that authorized cookies expire after the session ends, enhancing security.

Option C, scoping cookies to a relevant domain/path, can also improve security. By restricting the domain and path to which the cookies are applicable, the web application limits their accessibility and reduces the chances of unauthorized access.

Option D, replacing client-side cookies with server-side mechanisms, is a more general recommendation for improving security. Server-side mechanisms, such as session management and token-based authentication, can provide better control and security over user sessions.

User NOCARRIER
by
8.0k points