1. Home
  2. Security Hardening
  3. CIS Nginx Benchmark V1.0.0 L2 Webserver
  4. Ensure that Content Security Policy (CSP) is enabled and configured properly

Ensure that Content Security Policy (CSP) is enabled and configured properly

Details

Content Security Policy allows administrators to specify the locations from which allowable scripts may be executed, or if scripts may be executed at all. Content Security Policy should be used to improve user trust of your website.

Rationale:

Content Security Policies assist organizations in mitigating and reporting cross-site scripting (XSS) attacks.

Solution

Open your nginx configuration file that contains your server blocks. Add the below line into your server block to add Content-Security-Policy and direct your user agent to accept documents from only specific origins.

add_header Content-Security-Policy ‘default-src ‘self”;

Supportive Information

The following resource is also helpful.

This security hardening control applies to the following category of controls within NIST 800-53: Configuration Management.This control applies to the following type of system Unix.

References

Source

Updated on July 16, 2022
Was this article helpful?

Related Articles