From 2467d6a033515a9aaeae97261eed829ef87f032e Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 9 Nov 2025 22:10:48 -0800 Subject: [PATCH] middleware: Implement middleware for common headers such as CSP - This allows overriding these headers in individual pages easily instead of relaxing global policy. - Drop the obsolete CSP directive "block-all-mixed-content" and avoid a console warning in Firefox. Tests: - Load a page and notice in the browser developer tools that the three headers referrer-policy, content-security-policy, and x-content-type-options are set as before. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- .../apache2/conf-available/freedombox.conf | 42 --------- plinth/middleware.py | 90 +++++++++++++++++++ plinth/settings.py | 1 + 3 files changed, 91 insertions(+), 42 deletions(-) diff --git a/data/etc/apache2/conf-available/freedombox.conf b/data/etc/apache2/conf-available/freedombox.conf index 33d57a2a2..fffff0490 100644 --- a/data/etc/apache2/conf-available/freedombox.conf +++ b/data/etc/apache2/conf-available/freedombox.conf @@ -47,48 +47,6 @@ RedirectMatch "^/$" "/plinth" -## -## Disable sending Referer (sic) header from FreedomBox web interface to -## external websites. This improves privacy by not disclosing FreedomBox -## domains/URLs to external domains. Apps such as blogs which want to popularize -## themselves with referrer header may still do so. -## -## A strict Content Security Policy. -## - @fonts are allowed only from FreedomBox itself. -## - /