|
5 | 5 | # Mitigate the risk of cross-site scripting and other content-injection
|
6 | 6 | # attacks.
|
7 | 7 | #
|
8 |
| -# This can be done by setting a `Content Security Policy` which |
9 |
| -# whitelists trusted sources of content for your website. |
| 8 | +# This can be done by setting a `Content Security Policy` which whitelists |
| 9 | +# trusted sources of content for your website. |
10 | 10 | #
|
11 |
| -# There is no policy that fits all websites, you will have to modify |
12 |
| -# the `Content-Security-Policy` directives in the example depending |
13 |
| -# on your needs. |
| 11 | +# There is no policy that fits all websites, you will have to modify the |
| 12 | +# `Content-Security-Policy` directives in the example depending on your needs. |
14 | 13 | #
|
15 | 14 | # The example policy below aims to:
|
16 | 15 | #
|
17 |
| -# (1) Restrict all fetches by default to the origin of the current website |
18 |
| -# by setting the `default-src` directive to `'self'` - which acts as a |
| 16 | +# (1) Restrict all fetches by default to the origin of the current website by |
| 17 | +# setting the `default-src` directive to `'self'` - which acts as a |
19 | 18 | # fallback to all "Fetch directives" (https://developer.mozilla.org/en-US/docs/Glossary/Fetch_directive).
|
20 | 19 | #
|
21 | 20 | # This is convenient as you do not have to specify all Fetch directives
|
22 | 21 | # that apply to your site, for example:
|
23 | 22 | # `connect-src 'self'; font-src 'self'; script-src 'self'; style-src 'self'`, etc.
|
24 | 23 | #
|
25 |
| -# This restriction also means that you must explicitly define from |
26 |
| -# which site(s) your website is allowed to load resources from. |
| 24 | +# This restriction also means that you must explicitly define from which |
| 25 | +# site(s) your website is allowed to load resources from. |
27 | 26 | #
|
28 |
| -# (2) The `<base>` element is not allowed on the website. This is to |
29 |
| -# prevent attackers from changing the locations of resources loaded |
30 |
| -# from relative URLs. |
| 27 | +# (2) The `<base>` element is not allowed on the website. This is to prevent |
| 28 | +# attackers from changing the locations of resources loaded from relative |
| 29 | +# URLs. |
31 | 30 | #
|
32 |
| -# If you want to use the `<base>` element, then `base-uri 'self'` |
33 |
| -# can be used instead. |
| 31 | +# If you want to use the `<base>` element, then `base-uri 'self'` can be |
| 32 | +# used instead. |
34 | 33 | #
|
35 |
| -# (3) Form submissions are only allowed from the current website by |
36 |
| -# setting: `form-action 'self'`. |
| 34 | +# (3) Form submissions are only allowed from the current website by setting: |
| 35 | +# `form-action 'self'`. |
37 | 36 | #
|
38 |
| -# (4) Prevents all websites (including your own) from embedding your |
39 |
| -# webpages within e.g. the `<iframe>` or `<object>` element by |
40 |
| -# setting `frame-ancestors 'none'`. |
| 37 | +# (4) Prevents all websites (including your own) from embedding your webpages |
| 38 | +# within e.g. the `<iframe>` or `<object>` element by setting: |
| 39 | +# `frame-ancestors 'none'`. |
41 | 40 | #
|
42 |
| -# The `frame-ancestors` directive helps avoid "Clickjacking" attacks |
43 |
| -# and is similar to the `X-Frame-Options` header. |
| 41 | +# The `frame-ancestors` directive helps avoid "Clickjacking" attacks and |
| 42 | +# is similar to the `X-Frame-Options` header. |
44 | 43 | #
|
45 |
| -# Browsers that support the CSP header will ignore `X-Frame-Options` |
46 |
| -# if `frame-ancestors` is also specified. |
| 44 | +# Browsers that support the CSP header will ignore `X-Frame-Options` if |
| 45 | +# `frame-ancestors` is also specified. |
47 | 46 | #
|
48 |
| -# (5) Forces the browser to treat all the resources that are served over |
49 |
| -# HTTP as if they were loaded securely over HTTPS by setting the |
| 47 | +# (5) Forces the browser to treat all the resources that are served over HTTP |
| 48 | +# as if they were loaded securely over HTTPS by setting the |
50 | 49 | # `upgrade-insecure-requests` directive.
|
51 | 50 | #
|
52 |
| -# Please note that `upgrade-insecure-requests` does not ensure |
53 |
| -# HTTPS for the top-level navigation. If you want to force the |
54 |
| -# website itself to be loaded over HTTPS you must include the |
55 |
| -# `Strict-Transport-Security` header. |
| 51 | +# Please note that `upgrade-insecure-requests` does not ensure HTTPS for |
| 52 | +# the top-level navigation. If you want to force the website itself to be |
| 53 | +# loaded over HTTPS you must include the `Strict-Transport-Security` |
| 54 | +# header. |
56 | 55 | #
|
57 | 56 | # (6) The `Content-Security-Policy` header is included in all responses
|
58 | 57 | # that are able to execute scripting. This includes the commonly used
|
|
0 commit comments