mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
Fiddle with CSP stuff
This commit is contained in:
+19
-16
@@ -1,32 +1,35 @@
|
|||||||
const rootDomain = process.env.VITE_DOMAIN; // or your server IP for dev
|
const rootDomain = process.env.VITE_DOMAIN; // or your server IP for dev
|
||||||
import { SENTRY_HOST } from './src/lib/config.js';
|
import { SENTRY_HOST } from './src/lib/config.js';
|
||||||
import { SENTRY_REPORT_URL } from './src/lib/config.js';
|
import { SENTRY_REPORT_URL } from './src/lib/config.js';
|
||||||
|
|
||||||
|
const self = "'self'";
|
||||||
|
const none = "'none'";
|
||||||
/**
|
/**
|
||||||
* @type {import("@sveltejs/kit").CspDirectives}
|
* @type {import("@sveltejs/kit").CspDirectives}
|
||||||
*/
|
*/
|
||||||
const cspDirectives = {
|
const cspDirectives = {
|
||||||
'base-uri': ["self"],
|
'base-uri': [self],
|
||||||
'child-src': ["self", "blob:"],
|
'child-src': [self, "blob:"],
|
||||||
'connect-src': ["self", "https://*.google-analytics.com", "https://" + SENTRY_HOST],
|
'connect-src': [self, "https://*.google-analytics.com", "https://" + SENTRY_HOST],
|
||||||
// 'connect-src': ["self", 'ws://localhost:*', 'https://hcaptcha.com', 'https://*.hcaptcha.com'],
|
// 'connect-src': [self, 'ws://localhost:*', 'https://hcaptcha.com', 'https://*.hcaptcha.com'],
|
||||||
'img-src': ["self", 'data:',
|
'img-src': [self, 'data:',
|
||||||
'https://*.googletagmanager.com'],
|
'https://*.googletagmanager.com'],
|
||||||
'font-src': ["self", 'data:'],
|
'font-src': [self, 'data:'],
|
||||||
'form-action': ["self"],
|
'form-action': [self],
|
||||||
'frame-ancestors': ["self"],
|
'frame-ancestors': [self],
|
||||||
'frame-src': [
|
'frame-src': [
|
||||||
"self",
|
self,
|
||||||
// "https://*.stripe.com",
|
// "https://*.stripe.com",
|
||||||
// "https://*.facebook.com",
|
// "https://*.facebook.com",
|
||||||
// "https://*.facebook.net",
|
// "https://*.facebook.net",
|
||||||
// 'https://hcaptcha.com',
|
// 'https://hcaptcha.com',
|
||||||
// 'https://*.hcaptcha.com',
|
// 'https://*.hcaptcha.com',
|
||||||
],
|
],
|
||||||
'manifest-src': ["self"],
|
'manifest-src': [self],
|
||||||
'media-src': ["self", 'data:'],
|
'media-src': [self, 'data:'],
|
||||||
'object-src': ["none"],
|
'object-src': [none],
|
||||||
'style-src': ["self", "unsafe-inline"],
|
'style-src': [self, "unsafe-inline"],
|
||||||
// 'style-src': ["self", "'unsafe-inline'", 'https://hcaptcha.com', 'https://*.hcaptcha.com'],
|
// 'style-src': [self, "'unsafe-inline'", 'https://hcaptcha.com', 'https://*.hcaptcha.com'],
|
||||||
'default-src': [
|
'default-src': [
|
||||||
'self',
|
'self',
|
||||||
...(rootDomain ? [rootDomain, `ws://${rootDomain}`] : []),
|
...(rootDomain ? [rootDomain, `ws://${rootDomain}`] : []),
|
||||||
@@ -42,7 +45,7 @@ const cspDirectives = {
|
|||||||
// 'https://*.sentry.io',
|
// 'https://*.sentry.io',
|
||||||
],
|
],
|
||||||
'script-src': [
|
'script-src': [
|
||||||
"self",
|
self,
|
||||||
"unsafe-inline", // chrome suggestion
|
"unsafe-inline", // chrome suggestion
|
||||||
'https://*.googletagmanager.com'
|
'https://*.googletagmanager.com'
|
||||||
// 'https://*.stripe.com',
|
// 'https://*.stripe.com',
|
||||||
@@ -53,7 +56,7 @@ const cspDirectives = {
|
|||||||
// 'https://*.sentry.io',
|
// 'https://*.sentry.io',
|
||||||
// 'https://polyfill.io',
|
// 'https://polyfill.io',
|
||||||
],
|
],
|
||||||
'worker-src': ["self", "blob:"],
|
'worker-src': [self, "blob:"],
|
||||||
// remove report-to & report-uri if you do not want to use Sentry reporting
|
// remove report-to & report-uri if you do not want to use Sentry reporting
|
||||||
'report-to': ["csp-endpoint"],
|
'report-to': ["csp-endpoint"],
|
||||||
'report-uri': [
|
'report-uri': [
|
||||||
|
|||||||
Reference in New Issue
Block a user