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-12-15 19:19:04
..Directory-2024-01-21 15:17:04
00.phpFile17302023-12-15 19:19:04
10.phpFile14152023-12-15 19:19:04
11.phpFile14602023-12-15 19:19:04
12.phpFile14612023-12-15 19:19:04
13.phpFile13872023-12-15 19:19:04
14.phpFile13502023-12-15 19:19:04
15.phpFile13672023-12-15 19:19:04
16.phpFile3432023-09-29 13:45:40
99.phpFile15862023-12-15 19:19:04
CSP.htmlFile336792023-11-07 11:42:04
exercises.htmlFile166162023-11-07 11:42:04
index.html.oldFile42852023-12-01 20:12:05
index.phpFile59202023-12-15 19:19:04
instructions.phpFile26342023-09-29 13:45:40
solutions.txtFile21312023-09-29 13:45:40
style.cssFile17762023-09-29 13:45:40