Provide different CSP policy for private files

Created on 4 August 2020, almost 4 years ago
Updated 19 January 2024, 5 months ago

Problem/Motivation

The generated policy for page responses is likely too lenient for private files.

e.g. SVGs should likely be restricted from downloading any external resources by default

Proposed resolution

Send a different header value on either BinaryFileResponse instances, or on responses to the system.private_file_download route.

User interface changes

a) Provide an option (enabled by default) to add a hard-coded policy to all file responses. Values could be set for different mime-types in settings.php
b) Provide a single text field (or two, for report-only and enforced) to set a policy
c) Provide the same, full configuration interface as page responses (without values for CSS and JS from libraries)

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada gapple

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024