Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo committed Feb 4, 2025
1 parent 75d53b6 commit 7dbd770
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 3 additions & 0 deletions packages/app/sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Sentry.init({
environment: ENVIRONMENT,
debug: true, // Temporarily enable debug mode to troubleshoot

// Enable tunneling to avoid ad-blockers
tunnel: "/monitoring-tunnel",

// Performance monitoring
enableTracing: true,
tracesSampleRate: IS_PRODUCTION ? 0.1 : 1.0, // Sample 10% of traces in prod, all in dev
Expand Down
14 changes: 2 additions & 12 deletions packages/app/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ import { NextResponse } from "next/server";
import { type NextMiddlewareWithAuth, withAuth } from "next-auth/middleware";

const cspMiddleware: NextMiddlewareWithAuth = req => {
// Parse Sentry URL to get domain for CSP
let sentryDomain = "";
try {
if (process.env.SENTRY_URL) {
const url = new URL(process.env.SENTRY_URL);
sentryDomain = url.hostname;
}
} catch (e) {
console.warn("Failed to parse SENTRY_URL:", e);
}
//const nonce = Buffer.from(crypto.randomUUID()).toString("base64");

// In dev environment, Next injects scripts for HMR, so we need to desactivate script-src.
Expand Down Expand Up @@ -46,8 +36,8 @@ const cspMiddleware: NextMiddlewareWithAuth = req => {
// }

const cspHeader = `
default-src 'self' https://*.gouv.fr${sentryDomain ? ` https://${sentryDomain}` : ""};
connect-src 'self' https://*.gouv.fr${sentryDomain ? ` https://${sentryDomain}` : ""};
default-src 'self' https://*.gouv.fr;
connect-src 'self' https://*.gouv.fr;
font-src 'self' data: blob:;
media-src 'self' https://*.gouv.fr;
img-src 'self' data: https://*.gouv.fr;
Expand Down

0 comments on commit 7dbd770

Please sign in to comment.