add CSP-clean static build, hardened nginx config, and container image

This commit is contained in:
2026-07-27 11:10:20 +10:00
parent e45f5729fa
commit a3c6d33ecf
6 changed files with 165 additions and 1 deletions
+19
View File
@@ -0,0 +1,19 @@
# Shared security headers. `include`d in the server block AND in every location that
# sets its own add_header — a location-level add_header REPLACES inherited headers
# rather than merging them (the classic nginx footgun).
#
# HSTS is host-scoped: NO includeSubDomains / preload, because the *.bztmon.com
# wildcard points elsewhere and forcing HTTPS estate-wide from here would be reckless.
# HTTP->HTTPS upgrade is Cloudflare's job.
add_header Strict-Transport-Security "max-age=31536000" always;
# script-src 'self' with NO 'unsafe-inline'. build.sh externalises every script and
# hard-fails if an inline <script> reaches dist/, so this holds without an exception.
# style-src needs 'unsafe-inline': GSAP animates by writing inline style attributes.
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; worker-src 'self'; manifest-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=(), interest-cohort=()" always;
add_header Cross-Origin-Opener-Policy "same-origin" always;
add_header Cross-Origin-Resource-Policy "same-origin" always;