mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
Sentry: Allow connections + report CSP violations
This commit is contained in:
+13
-7
@@ -1,9 +1,12 @@
|
|||||||
const rootDomain = process.env.VITE_DOMAIN; // or your server IP for dev
|
const rootDomain = process.env.VITE_DOMAIN; // or your server IP for dev
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import("@sveltejs/kit").CspDirectives}
|
||||||
|
*/
|
||||||
const cspDirectives = {
|
const cspDirectives = {
|
||||||
'base-uri': ["'self'"],
|
'base-uri': ["'self'"],
|
||||||
'child-src': ["'self'"],
|
'child-src': ["'self'", "blob:"],
|
||||||
'connect-src': ["'self'", "https://*.google-analytics.com"],
|
'connect-src': ["'self'", "https://*.google-analytics.com", "https://*.sentry.io"],
|
||||||
// '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'],
|
||||||
@@ -49,12 +52,15 @@ const cspDirectives = {
|
|||||||
// 'https://*.sentry.io',
|
// 'https://*.sentry.io',
|
||||||
// 'https://polyfill.io',
|
// 'https://polyfill.io',
|
||||||
],
|
],
|
||||||
'worker-src': ["'self'"],
|
'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': [
|
||||||
// `https://sentry.io/api/${process.env.VITE_SENTRY_PROJECT_ID}/security/?sentry_key=${process.env.VITE_SENTRY_KEY}`,
|
'https://o4507835405369344.ingest.de.sentry.io/api/4507835410481232/security/?sentry_key=d006c73cc53783930a1521a68ae1c312',
|
||||||
// ],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Report-To: {"group":"csp-endpoint","max_age":10886400,"endpoints":[{"url":"https://o4507835405369344.ingest.de.sentry.io/api/4507835410481232/security/?sentry_key=d006c73cc53783930a1521a68ae1c312"}],"include_subdomains":true}
|
||||||
|
|
||||||
|
|
||||||
export default cspDirectives;
|
export default cspDirectives;
|
||||||
@@ -19,6 +19,7 @@ const securityHeaders = {
|
|||||||
'Cross-Origin-Opener-Policy': 'same-origin',
|
'Cross-Origin-Opener-Policy': 'same-origin',
|
||||||
'Cross-Origin-Resource-Policy': 'same-origin',
|
'Cross-Origin-Resource-Policy': 'same-origin',
|
||||||
|
|
||||||
|
'Report-To': '{"group":"csp-endpoint","max_age":10886400,"endpoints":[{"url":"https://o4507835405369344.ingest.de.sentry.io/api/4507835410481232/security/?sentry_key=d006c73cc53783930a1521a68ae1c312"}],"include_subdomains":true}',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const handle: Handle = sequence(Sentry.sentryHandle(), async ({ event, resolve }) => {
|
export const handle: Handle = sequence(Sentry.sentryHandle(), async ({ event, resolve }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user