Skip to content

Commit 34653c6

Browse files
authored
Update Django_Security_Cheat_Sheet.md
1 parent 7045bab commit 34653c6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cheatsheets/Django_Security_Cheat_Sheet.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ In the default app folder within your project, locate the `urls.py` file managin
170170

171171
## Content Security Policy
172172

173-
- Include the `django.middleware.csp.ContentSecurityPolicyMiddleware` module in the `MIDDLEWARE` setting in your project's `settings.py` to add CSP related header to your responses.
174-
- Configure the CSP policies in your settings.py using the `SECURE_CSP` parameter, for example :
173+
- Include the `django.middleware.csp.ContentSecurityPolicyMiddleware` module in the `MIDDLEWARE` setting in your project's `settings.py` to add CSP-related header to your responses ([documentation](https://docs.djangoproject.com/fr/6.0/howto/csp/#basic-config)).
174+
- Configure the CSP policies in settings.py using the `SECURE_CSP` parameter, for example:
175175

176176
```py
177177
from django.utils.csp import CSP
@@ -182,7 +182,7 @@ SECURE_CSP = {
182182
"style-src": [CSP.SELF],
183183
}
184184
```
185-
- Add the csp context processor to your TEMPLATES setting, this will add the nonce to the context of all your Django templates
185+
- Add the CSP context processor to your TEMPLATES setting. This will add the nonce to the context of all your Django templates:
186186

187187
```py
188188
TEMPLATES = [
@@ -198,7 +198,7 @@ TEMPLATES = [
198198
]
199199
```
200200

201-
- In your templates add the nonce were it is needed:
201+
- In your templates, add the [nonce](https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html#nonce-based) where it is needed:
202202

203203
```html
204204
<script nonce="{{ csp_nonce }}">

0 commit comments

Comments
 (0)