#106598Content Security Policy / Firefox
Description
*Backend, Modul Filelist*
If selecting more than one file for Download, a CSP Violation occurs and the download fails with:
Details
Direktive / Verwendung
frame-src / enforce
URI des Dokuments
https://epx-typo3-demo.ddev.site/typo3/main?redirect=media_management&redirectParams=id%3D1%253A%2Fdummys%2F&referrer-refresh=1745390035
Blockierte URI
blob
User-Agent
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0
UUID
bc4181c2-f3fc-40fa-a2c7-212b3f2cabd4
Übersicht
0cd9a0289ef425b5346bc4326c7aab82ff851f84
Browserlog
Content-Security-Policy: Die Einstellungen der Seite haben das Laden einer Ressource (frame-src) auf blob:https://epx-typo3-demo.ddev.site/ed93011d-dfda-4ce6-89a8-dedac737b323 blockiert, da sie gegen folgende Direktive verstößt: “frame-src ‘self’ https://*.youtube-nocookie.com https://*.youtube.com https://*.vimeo.com”
So the download of multiple Files fails
Reviews 2
Related issues 1
History 89
-
Garvin Hicking commented and changed status
NewAccepted <span data-processor="relativetime" data-value="2025-04-23T08:01:33+00:00" > 04/23/25, 08:01 </span> -
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-04-23T08:07:09+00:00" > 04/23/25, 08:07 </span>
Internal note via Slack https://typo3.slack.com/archives/C03AM9R17/p1745395587116859
CSP blocks backend filelist downloads of multiple files due to it using an iframe with blob inline contents. I assume adding “blob:” to the allowed frame-src attribute would not be wise in terms of security; can we use a nonce on such created iframe sources within pure javascript?
(The JS code is in Build/Sources/TypeScript/filelist/file-list.ts:L349) -
Oliver Hader commented <span data-processor="relativetime" data-value="2025-04-23T09:01:12+00:00" > 04/23/25, 09:01 </span>
Garvin Hicking wrote in #note-2:
> Internal note via Slack https://typo3.slack.com/archives/C03AM9R17/p1745395587116859
>
> CSP blocks backend filelist downloads of multiple files due to it using an iframe with blob inline contents. I assume adding “blob:” to the allowed frame-src attribute would not be wise in terms of security; can we use a nonce on such created iframe sources within pure javascript?
> (The JS code is in Build/Sources/TypeScript/filelist/file-list.ts:L349)Actually the server just responds with the zipped file to be retrieved – the blob references seem to stem from the browser directly.
This is the actual server response:
HTTP/1.1 200 OK Date: Wed, 23 Apr 2025 08:51:31 GMT Content-Disposition: attachment; filename=typo3_download_2025-04-23-105131.zip Content-Transfer-Encoding: binary Pragma: no-cache Cache-Control: no-cache, no-store X-Frame-Options: SAMEORIGIN X-Content-Type-Options: nosniff Referrer-Policy: strict-origin-when-cross-origin Content-Security-Policy: default-src 'self'; script-src 'self' 'report-sample'; style-src 'self' 'unsafe-inline' 'report-sample'; style-src-attr 'unsafe-inline' 'report-sample'; img-src 'self' data: *.ytimg.com *.vimeocdn.com https://extensions.typo3.org; frame-src 'self' *.youtube-nocookie.com *.youtube.com *.vimeo.com; base-uri 'none'; object-src 'none'; report-uri https://ip14.anyhost.it/admin/@http-reporting?csp=report&requestTime=1745398291022283&requestHash=c6460b7eef2d7f82977e6138e3d9d06ecddb69bd Expires: 0 Last-Modified: Wed, 23 Apr 2025 08:51:31 GMT Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: application/zip
Thus, for the corresponding download action, I guess(!) it would be fine, to allow
blob:[origin], e.g.blob:https://ip14.anyhost.it/temporarily. -
Oliver Hader commented <span data-processor="relativetime" data-value="2025-04-23T09:12:33+00:00" > 04/23/25, 09:12 </span>
Hm… the CSP violation happens in the main thread on
https://ip14.anyhost.it/admin/main?token=[...], not during the download.
Thus, “allow blob: temporarily” won’t work… -
Oliver Hader commented <span data-processor="relativetime" data-value="2025-04-23T21:52:18+00:00" > 04/23/25, 21:52 </span>
I had the impression, that Firefox would cause this behavior internally – however, it seems our own code is causing this (the file was referenced before already):
https://github.com/TYPO3/typo3/blob/4dc6176f95f2d153931bb4f3a24e09fce586532e/Build/Sources/TypeScript/filelist/file-list.ts#L349-L350 -
Gerrit Code Review pushed patch set 1 for main to change 89212 status
AcceptedUnder Review <span data-processor="relativetime" data-value="2025-04-24T08:46:11+00:00" > 04/24/25, 08:46 </span> -
Oliver Hader commented <span data-processor="relativetime" data-value="2025-04-24T08:53:40+00:00" > 04/24/25, 08:53 </span>
I pushed a proof-of-concept, avoiding to use
<a download>for blob URIs – which is blocked in Firefox.The JavaScript handling (AJAX, blob, download via blob) is basically used to inform users what is currently happening using notifications.
Probably a better approach would be to use service workers, that would serve the file directly, but send messages to the client UI the action is about to start and when it has been finished. This also would avoid loading the whole AJAX response into browser memory and running into limits (e.g. https://chromium.googlesource.com/chromium/src/+/main/storage/browser/blob/README.md#example-limits).
-
Oliver Hader commented <span data-processor="relativetime" data-value="2025-04-24T08:57:59+00:00" > 04/24/25, 08:57 </span>
Side-note: An alternative using writeable file streams probably would not work in Firefox, due to the lack of support for https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker
-
Benni Mack changed Related to #111096 <span data-processor="relativetime" data-value="2026-11-18T21:39:20+00:00" > 11/18/26, 21:39 </span>
Thanks for the report! Reproduced in main:
- Go to “File > Filelist“
- Check the boxes next to at least two files
- Click on the “Download” button
Error does not show up in Chromium for me (macOSX).