What is CSP?

Content Security Policy (CSP) is a security feature that helps prevent cross-site scripting (XSS) attacks on web pages. It allows website owners to specify which sources of content are allowed to be loaded on their pages.

What does CSP protect from?

CSP protects from cross-site scripting (XSS) attacks, which are a common type of web vulnerability. XSS attacks occur when an attacker injects malicious code into a web page, which can steal user data or perform unauthorized actions on behalf of the user.

Content Security Policy (CSP) Example

Content Security Policy (CSP) Example

This page demonstrates how to define a Content Security Policy for your website. The following CSP header only allows resources to be loaded from the same origin as the website:

Content-Security-Policy: default-src 'self'

You can customize this header to meet the specific needs of your website. For example, you can allow resources to be loaded from multiple sources:

Content-Security-Policy: default-src 'self' https://example.com https://cdn.example.com;

In this case, resources can be loaded from the same origin as the website, as well as from https://example.com and https://cdn.example.com.

What is CSP used for?

CSP is used to help protect websites from XSS attacks. By specifying which sources of content are allowed to be loaded on a page, website owners can prevent malicious code from being injected into their pages. This can help improve the overall security of a website and protect user data.

Name Type Size Last Modified
.Directory-2023-04-13 22:19:04
..Directory-2023-06-02 09:58:49
00.phpFile12432023-03-25 20:16:05
10.phpFile9282023-03-25 20:16:05
11.phpFile9732023-03-25 20:16:05
12.phpFile9742023-03-25 20:16:05
13.phpFile9002023-03-25 20:16:05
14.phpFile8632023-03-25 20:16:05
15.phpFile8802023-03-25 20:16:05
16.phpFile3432023-04-11 20:21:37
99.phpFile10992023-03-25 20:16:05
CSP.htmlFile333402023-03-25 20:16:05
exercises.htmlFile162742023-03-25 20:16:05
index.phpFile54332023-04-11 20:31:24
instructions.phpFile26342023-04-13 22:19:04
solutions.txtFile21312023-04-11 20:11:03
style.cssFile17762023-04-11 20:24:50