JN0-336 practice question 3 of 10

What is the purpose of using Content Security Policy (CSP) in web applications?

Full set: 75 questions
Answer options
A: To prevent Cross-Site Scripting (XSS) attacks Correct answer
B: To encrypt data transmission
C: To implement multi-factor authentication
D: To manage user sessions
Correct Answer:
A. To prevent Cross-Site Scripting (XSS) attacks
Explanation

The primary purpose of a Content Security Policy (CSP) is to mitigate and report on certain types of injection attacks, with Cross-Site Scripting (XSS) being the most prominent. CSP is an added layer of security that allows web administrators to control the resources a user agent is allowed to load for a given page. By defining a whitelist of trusted content sources, CSP instructs the browser to only execute scripts from those sources, effectively preventing the browser from loading malicious assets injected into a vulnerable web application.

Why Incorrect

B. Data transmission is encrypted by protocols like TLS/SSL, not by CSP, which is a policy for loading web page resources.
C. Multi-factor authentication is a process for verifying user identity and is unrelated to preventing script injection attacks.
D. User sessions are managed with mechanisms like cookies and server-side tokens, which are distinct from CSP's function.

References

- Juniper Networks Knowledge Base, Article KB31991, "[Junos] How to configure HTTP/HTTPS access for J-Web, including ciphers, and headers like HSTS, X-Frame-Options, Content-Security-Policy." This article explicitly shows how to configure a CSP header on a Juniper device to enhance security.

- Mozilla Developer Network (MDN), "Content Security Policy (CSP)." As a definitive resource on web standards, it states, "CSP makes it possible for server administrators to reduce or eliminate the vectors by which XSS can occur by specifying the domains that the browser should consider to be legitimate sources of executable scripts."

Scroll to Top