|
1 | 1 | """
|
2 | 2 | Django settings for userportal project.
|
3 |
| -
|
4 |
| -Generated by 'django-admin startproject' using Django 3.1.7. |
5 |
| -
|
6 |
| -For more information on this file, see |
7 |
| -https://docs.djangoproject.com/en/3.1/topics/settings/ |
8 |
| -
|
9 |
| -For the full list of settings and their values, see |
10 |
| -https://docs.djangoproject.com/en/3.1/ref/settings/ |
11 | 3 | """
|
12 | 4 |
|
13 | 5 | from pathlib import Path
|
|
43 | 35 | 'django.contrib.staticfiles',
|
44 | 36 | 'django.contrib.humanize',
|
45 | 37 | 'djangosaml2',
|
| 38 | + 'csp', |
46 | 39 | 'watchman',
|
47 | 40 |
|
48 | 41 | 'pages',
|
|
78 | 71 | 'django.contrib.messages.middleware.MessageMiddleware',
|
79 | 72 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
80 | 73 | 'djangosaml2.middleware.SamlSessionMiddleware',
|
| 74 | + 'csp.middleware.CSPMiddleware', |
81 | 75 | ]
|
82 | 76 |
|
83 | 77 | ROOT_URLCONF = 'userportal.urls'
|
|
204 | 198 | 'DEFAULT_PAGINATION_CLASS': 'rest_framework_datatables.pagination.DatatablesPageNumberPagination',
|
205 | 199 | 'PAGE_SIZE': 100,
|
206 | 200 | }
|
| 201 | + |
| 202 | +# Content Security Policy |
| 203 | +CSP_DEFAULT_SRC = ("'self'") |
| 204 | +CSP_IMG_SRC = ("'self'", "data:", 'object-arbutus.cloud.computecanada.ca') |
| 205 | +CSP_STYLE_SRC = ("'self'", "'unsafe-inline'", 'cdn.jsdelivr.net', 'cdnjs.cloudflare.com', 'cdn.datatables.net') |
| 206 | +CSP_SCRIPT_SRC = ("'self'", "'unsafe-inline'", 'cdn.jsdelivr.net', 'cdnjs.cloudflare.com', 'cdn.datatables.net', 'code.jquery.com', 'cdn.plot.ly') |
0 commit comments