mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 01:16:10 +00:00
feat(security): every page carries a Content-Security-Policy that needs no template change
A small middleware sends object-src 'none', base-uri 'self', form-action 'self' and frame-ancestors 'none': no plugin content, no injected <base> redirecting relative URLs, no form posting to another origin, no framing. script-src and style-src are left out: the templates still hold inline scripts, event handlers and javascript: URLs, which an enforced script policy would block. The middleware is added to the settings template, which the update steps and each Docker container rebuild settings.py from.
This commit is contained in:
parent
75559629e4
commit
6f44461c28
4 changed files with 30 additions and 0 deletions
|
|
@ -99,6 +99,7 @@ MIDDLEWARE = [
|
|||
"django.contrib.auth.middleware.RemoteUserMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
"webvirtcloud.middleware.ContentSecurityPolicyMiddleware",
|
||||
"appsettings.middleware.AppSettingsMiddleware",
|
||||
"webvirtcloud.middleware.ExceptionMiddleware",
|
||||
# last, as django-axes requires
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue