Skip to content

Commit 906eb83

Browse files
authored
Add a CSP header and a reporting URI (#101)
Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>
1 parent 800a3b5 commit 906eb83

2 files changed

Lines changed: 27 additions & 10 deletions

File tree

gatsby-config.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ module.exports = {
2121
siteUrl: 'https://px.dev',
2222
},
2323
plugins: [
24-
'gatsby-plugin-netlify',
2524
{
2625
resolve: 'gatsby-plugin-google-tagmanager',
2726
options: {
@@ -30,6 +29,33 @@ module.exports = {
3029
defaultDataLayer: { platform: 'gatsby' },
3130
},
3231
},
32+
{
33+
resolve: 'gatsby-plugin-netlify',
34+
options: {
35+
allPageHeaders: [
36+
'Content-Security-Policy: '
37+
+ "base-uri 'self';"
38+
+ "default-src 'self';"
39+
+ "connect-src 'self' https://stats.g.doubleclick.net https://www.google-analytics.com/j/collect;"
40+
+ "frame-src 'self' https://app.netlify.com;"
41+
+ "font-src 'self' data: https://fonts.gstatic.com;"
42+
+ "form-action 'self';"
43+
+ "img-src 'self' data: https://analytics.twitter.com https://d33wubrfki0l68.cloudfront.net https://t.co https://www.google.com;"
44+
+ "media-src 'self' https://d33wubrfki0l68.cloudfront.net;"
45+
+ "object-src 'none';"
46+
+ "script-src 'self' 'unsafe-inline' https://cdn.segment.io https://d33wubrfki0l68.cloudfront.net https://js.hs-scripts.com/8260834.js https://netlify-cdp-loader.netlify.app/netlify.js https://static.ads-twitter.com/uwt.js https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtm.js;"
47+
+ "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;"
48+
+ 'report-to default;'
49+
+ 'report-uri https://6703fcfa5dc750f546d44b0af80c78d5.report-uri.com/r/d/csp/enforce',
50+
'Permissions-Policy: camera=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), vibrate=()',
51+
'Report-To: {"group":"default","max_age":31536000,"endpoints":[{"url":"https://6703fcfa5dc750f546d44b0af80c78d5.report-uri.com/a/d/g"}],"include_subdomains":true}',
52+
'Referrer-Policy: strict-origin-when-cross-origin',
53+
'X-Content-Type-Options: nosniff',
54+
'X-Frame-Options: SAMEORIGIN',
55+
'X-XSS-Protection: 1; mode=block',
56+
],
57+
},
58+
},
3359
'gatsby-plugin-react-helmet',
3460
'gatsby-plugin-sitemap',
3561
'gatsby-plugin-scroll-reveal',

netlify.toml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22
publish ="public/"
33
command = "yarn install && yarn lint && gatsby build"
44

5-
[[headers]]
6-
for = "/*"
7-
[headers.values]
8-
Permissions-Policy = "camera=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), vibrate=()"
9-
Referrer-Policy = "strict-origin-when-cross-origin"
10-
X-Content-Type-Options = "nosniff"
11-
X-Frame-Options = "SAMEORIGIN"
12-
X-XSS-Protection = "1; mode=block"
13-
145
[[redirects]]
156
from = "/blog"
167
to = "https://blog.px.dev"

0 commit comments

Comments
 (0)