mirror of
https://github.com/linagora/tmail-flutter.git
synced 2026-12-05 16:08:46 +00:00
* Move inline web scripts to files and enforce the nginx page policy * Render CSP_* through the nginx image entrypoint and allow blob: in connect-src * Allow CSP_IMG_SRC and document nginx add_header inheritance and connect-src ports * Keep a read-only logo mount from stopping nginx and add optional CSP_REPORT_URI * fix: start nginx when the root or a logo mount is read-only * docs: document the web CSP variables and upgrade steps --------- Co-authored-by: Dat H. Pham <dphamhoang@linagora.com>
6 lines
1.3 KiB
Plaintext
6 lines
1.3 KiB
Plaintext
# 'unsafe-inline' remains because the mail viewer and composer inject scripts into srcdoc iframes, which inherit this policy.
|
|
# CSP_FRAME_ANCESTORS, CSP_FRAME_SRC, CSP_SCRIPT_SRC, CSP_CONNECT_SRC and CSP_IMG_SRC are rendered at container start when /etc/nginx is writable (see Dockerfile / README).
|
|
# CSP_REPORT_URI, when set, is added as report-uri on the report-only header by docker-entrypoint.d/25-csp-report-uri.sh.
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval' ${CSP_SCRIPT_SRC}; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https: ${CSP_IMG_SRC}; font-src 'self' data:; connect-src 'self' blob: https: wss: ${CSP_CONNECT_SRC}; frame-src 'self' blob: about: ${CSP_FRAME_SRC}; worker-src 'self' blob:; frame-ancestors ${CSP_FRAME_ANCESTORS}; object-src 'none'; base-uri 'self'; form-action 'none'" always;
|
|
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' 'wasm-unsafe-eval' ${CSP_SCRIPT_SRC}; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https: ${CSP_IMG_SRC}; font-src 'self' data:; connect-src 'self' blob: https: wss: ${CSP_CONNECT_SRC}; frame-src 'self' blob: about: ${CSP_FRAME_SRC}; worker-src 'self' blob:; frame-ancestors ${CSP_FRAME_ANCESTORS}; object-src 'none'; base-uri 'self'; form-action 'none'" always;
|