mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-25 10:59:35 +00:00
Allow file downloads and modals in HTML sandbox
This commit is contained in:
parent
628f794b37
commit
dcafc8a1a1
2 changed files with 2 additions and 2 deletions
|
|
@ -69,7 +69,7 @@ class AttachmentFileController extends AbstractController
|
||||||
|
|
||||||
//Set an CSP that allows to run inline scripts, styles and images from external ressources, but does not allow any connections or others.
|
//Set an CSP that allows to run inline scripts, styles and images from external ressources, but does not allow any connections or others.
|
||||||
//Also set the sandbox CSP directive with only "allow-script" to run basic scripts
|
//Also set the sandbox CSP directive with only "allow-script" to run basic scripts
|
||||||
$response->headers->set('Content-Security-Policy', "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:; sandbox allow-scripts;");
|
$response->headers->set('Content-Security-Policy', "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:; sandbox allow-scripts allow-downloads allow-modals;");
|
||||||
|
|
||||||
//Forbid to embed the attachment render page in an iframe to prevent clickjacking, as it is not used anywhere else for now
|
//Forbid to embed the attachment render page in an iframe to prevent clickjacking, as it is not used anywhere else for now
|
||||||
$response->headers->set('X-Frame-Options', 'DENY');
|
$response->headers->set('X-Frame-Options', 'DENY');
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
|
|
||||||
<iframe referrerpolicy="no-referrer" class="content-frame"
|
<iframe referrerpolicy="no-referrer" class="content-frame"
|
||||||
{# When changing this sandbox, also change the sandbox CSP in the controller #}
|
{# When changing this sandbox, also change the sandbox CSP in the controller #}
|
||||||
sandbox="allow-scripts"
|
sandbox="allow-scripts allow-downloads allow-modals"
|
||||||
srcdoc="{{ content|e('html_attr') }}"
|
srcdoc="{{ content|e('html_attr') }}"
|
||||||
></iframe>
|
></iframe>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue