feat: add CSP via <meta> tag

* <meta> doesn't support frame-ancestors directive
  * '*--curben.netlify.com' is invalid
  * add localhost
  * block-all-mixed-content works with localhost
This commit is contained in:
curben 2019-05-21 14:41:56 +09:30
parent 03c527b2f5
commit 821ac056b7
2 changed files with 3 additions and 1 deletions

View File

@ -8,7 +8,7 @@
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
Content-Security-Policy = "default-src https; script-src https://cdnjs.cloudflare.com https://curben.netlify.com https://*--curben.netlify.com 'unsafe-inline'; style-src https://cdnjs.cloudflare.com https://curben.netlify.com https://*--curben.netlify.com; block-all-mixed-content; form-action 'none'; frame-ancestors 'none'"
Content-Security-Policy = "default-src https localhost:4000; script-src https://cdnjs.cloudflare.com https://*.netlify.com localhost:4000; style-src https://cdnjs.cloudflare.com https://*.netlify.com localhost:4000; frame-ancestors 'none'; block-all-mixed-content;"
Referrer-Policy = "no-referrer"
Strict-Transport-Security = "max-age=31536000"
Feature-Policy = "accelerometer 'none'; autoplay 'none'; camera 'none'; document.domain 'none'; display-capture 'none'; encrypted-media 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; sync-xhr 'none'; usb 'none'"

View File

@ -2,6 +2,8 @@
<html lang="<%= theme.language %>">
<head>
<meta charset="utf-8">
<%/* CSP */%>
<meta http-equiv="Content-Security-Policy" content="default-src https localhost:4000; script-src https://cdnjs.cloudflare.com https://*.netlify.com localhost:4000; style-src https://cdnjs.cloudflare.com https://*.netlify.com localhost:4000; form-action 'none'; block-all-mixed-content;">
<%
let title = page.title