|
1 | 1 |
|
| 2 | +// Where the site loads things from: Firebase (Auth, Firestore, Storage, |
| 3 | +// Functions), App Check's reCAPTCHA, Google Analytics, and the Discord and |
| 4 | +// YouTube embeds. Images can come from any https address, since profile |
| 5 | +// pictures are links members add. |
| 6 | +const CONTENT_SECURITY_POLICY = [ |
| 7 | + "default-src 'self'", |
| 8 | + "script-src 'self' 'unsafe-inline' https://www.google.com https://www.gstatic.com https://apis.google.com https://www.googletagmanager.com", |
| 9 | + "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com", |
| 10 | + "font-src 'self' data: https://fonts.gstatic.com", |
| 11 | + "img-src 'self' data: blob: https:", |
| 12 | + "connect-src 'self' https://*.googleapis.com https://*.firebaseio.com wss://*.firebaseio.com https://*.cloudfunctions.net https://*.run.app https://www.google-analytics.com https://*.google-analytics.com https://www.googletagmanager.com https://www.google.com", |
| 13 | + "frame-src 'self' https://*.firebaseapp.com https://www.google.com https://recaptcha.google.com https://discord.com https://www.youtube.com https://www.youtube-nocookie.com", |
| 14 | + "media-src 'self' https:", |
| 15 | + "object-src 'none'", |
| 16 | + "base-uri 'self'", |
| 17 | + "form-action 'self'", |
| 18 | + "frame-ancestors 'self'", |
| 19 | +].join('; '); |
| 20 | + |
2 | 21 | /** @type {import('next').NextConfig} */ |
3 | 22 | const nextConfig = { |
4 | 23 | images: { |
@@ -30,6 +49,10 @@ const nextConfig = { |
30 | 49 | { key: 'X-Content-Type-Options', value: 'nosniff' }, |
31 | 50 | { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' }, |
32 | 51 | { key: 'Permissions-Policy', value: 'camera=(self), microphone=(self), geolocation=(), payment=(), usb=()' }, |
| 52 | + // Report-only for now: browsers log anything this would block in the |
| 53 | + // console, without blocking it. Once it's quiet, rename the key to |
| 54 | + // Content-Security-Policy to enforce it. |
| 55 | + { key: 'Content-Security-Policy-Report-Only', value: CONTENT_SECURITY_POLICY }, |
33 | 56 | ], |
34 | 57 | }]; |
35 | 58 | }, |
|
0 commit comments