mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-06-24 03:21:38 +00:00
Set CSP policy for static assets for security hardeninng
This commit is contained in:
parent
0cd83f0322
commit
b62f47ba05
6 changed files with 29 additions and 9 deletions
|
|
@ -122,7 +122,7 @@ class AttachmentFileController extends AbstractController
|
|||
private function setAttachmentCSPHeaders(Response $response): Response
|
||||
{
|
||||
//Set an CSP that disallow to run any scripts, styles or images from the attachment render page, as it is not used anywhere else for now and can be a security risk if used without proper precautions, so it should be opt-in
|
||||
$response->headers->set('Content-Security-Policy', "default-src 'none'; script-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self'; sandbox;");
|
||||
$response->headers->set('Content-Security-Policy', "default-src 'self'; script-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; sandbox;");
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue