mirror of
https://github.com/linagora/tmail-flutter.git
synced 2026-12-06 00:05:29 +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>
12 lines
490 B
Bash
Executable File
12 lines
490 B
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
# [ -w ] is true for root on a read-only mount. Keep the headers baked at build.
|
|
if ! probe=$(mktemp /etc/nginx/.w.XXXXXX 2>/dev/null); then
|
|
echo "warning: /etc/nginx is not writable; using the CSP headers baked into the image. Runtime CSP_* values are ignored." >&2
|
|
exit 0
|
|
fi
|
|
rm -f "$probe"
|
|
|
|
envsubst '${CSP_FRAME_ANCESTORS} ${CSP_FRAME_SRC} ${CSP_SCRIPT_SRC} ${CSP_CONNECT_SRC} ${CSP_IMG_SRC}' \
|
|
< /etc/nginx/csp-headers.conf.template > /etc/nginx/csp-headers.conf
|