Merge pull request 'security: enforce Content-Security-Policy' (#13) from kristijan-dev into develop
Deploy to Production on Develop Push / deploy (push) Successful in 12s Details

This commit is contained in:
popovskik 2026-08-04 08:48:52 +00:00
commit c092e65ae0
1 changed files with 10 additions and 3 deletions

View File

@ -92,9 +92,16 @@ Options -Indexes
Header always set Referrer-Policy "strict-origin-when-cross-origin" Header always set Referrer-Policy "strict-origin-when-cross-origin"
# Explicitly disable browser features the site doesn't use. # Explicitly disable browser features the site doesn't use.
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=(), interest-cohort=()" Header always set Permissions-Policy "camera=(), microphone=(), geolocation=(), interest-cohort=()"
# Content-Security-Policy in REPORT-ONLY first so it cannot break styling/scripts. # Content-Security-Policy (ENFORCING). Allowlist verified in a browser
# Review browser console for violations, tighten, then switch to Content-Security-Policy. # against a server sending this exact header — every real resource passes:
Header always set Content-Security-Policy-Report-Only "default-src 'self'; img-src 'self' data: https:; style-src 'self' 'unsafe-inline'; script-src 'self' https://www.googletagmanager.com; connect-src 'self' https://www.google-analytics.com https://region1.google-analytics.com; frame-src https://www.youtube-nocookie.com https://www.youtube.com; frame-ancestors 'self'; base-uri 'self'; form-action 'self' https://docs.google.com" # self assets, Google Fonts, Font Awesome (cdnjs), gtag, GA beacons, the
# Google Forms endpoint (membership + guide feedback), the MailerLite JSONP
# newsletter, and YouTube (nocookie) embeds. 'unsafe-inline' is required for
# the in-<head> consent/analytics bootstrap and a few inline handlers; the
# host allowlists still constrain where scripts load from and where data can
# be sent (connect/form-action/base-uri/object-src), which is the real value
# here on top of the site's existing output escaping.
Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' https://www.googletagmanager.com https://assets.mailerlite.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdnjs.cloudflare.com; font-src 'self' https://fonts.gstatic.com https://cdnjs.cloudflare.com data:; img-src 'self' data: https:; connect-src 'self' https://www.google-analytics.com https://region1.google-analytics.com https://analytics.google.com https://www.googletagmanager.com https://docs.google.com https://assets.mailerlite.com; frame-src https://www.youtube-nocookie.com https://www.youtube.com; frame-ancestors 'self'; base-uri 'self'; form-action 'self' https://docs.google.com; object-src 'none'"
<FilesMatch "\.html$"> <FilesMatch "\.html$">
Header set Cache-Control "no-cache, must-revalidate" Header set Cache-Control "no-cache, must-revalidate"
</FilesMatch> </FilesMatch>