forked from shaba/openuds
added Content-Security-Policy to security
This commit is contained in:
parent
e18f3746b4
commit
8bebce4c6e
@ -68,4 +68,10 @@ class UDSSecurityMiddleware:
|
|||||||
)
|
)
|
||||||
return HttpResponse(content='Forbbiden', status=403)
|
return HttpResponse(content='Forbbiden', status=403)
|
||||||
|
|
||||||
return self.get_response(request)
|
response = self.get_response(request)
|
||||||
|
# Legacy browser support for X-XSS-Protection
|
||||||
|
response.headers.setdefault('X-XSS-Protection', '1; mode=block')
|
||||||
|
# Add Content-Security-Policy, allowing same origin and inline scripts, images from any https source and data:
|
||||||
|
response.headers.setdefault('Content-Security-Policy', "default-src 'self' 'unsafe-inline'; img-src 'self' https: data:;")
|
||||||
|
|
||||||
|
return response
|
||||||
|
Loading…
Reference in New Issue
Block a user