Fix: update csp headers in bridge ui (#1187)

* fix: update csp headers in bridge ui

* fix: update csp headers in bridge ui
This commit is contained in:
Victorien Gauch
2025-06-18 17:25:48 +02:00
committed by GitHub
parent cfa69b8146
commit 7431c91ca2

View File

@@ -7,7 +7,7 @@ export function middleware(request: NextRequest) {
// We only want to allow unsafe-eval in local environment for NextJS dev server
// We are required to use unsafe-inline with Cloudflare - https://developers.cloudflare.com/fundamentals/reference/policies-compliances/content-security-policies/#product-requirements
// TODO: Remove unsafe-eval in production and replace with 'unsafe-inline'
const unsafeScript = process.env.NEXT_PUBLIC_ENVIRONMENT === "local" ? "'unsafe-eval'" : "'unsafe-eval'";
// const unsafeScript = process.env.NEXT_PUBLIC_ENVIRONMENT === "local" ? "'unsafe-eval'" : "'unsafe-eval'";
/**
* Content Security Policy (CSP) configuration:
@@ -54,8 +54,7 @@ export function middleware(request: NextRequest) {
*/
const cspHeader = `
default-src 'self';
script-src 'self' 'nonce-${nonce}' ${unsafeScript} https://bridge.linea.build https://bridge-devnet.linea.build
https://www.googletagmanager.com/gtm.js https://widget.intercom.io/widget/h5zisg78;
script-src 'self' 'nonce-${nonce}' https://www.googletagmanager.com/gtm.js https://widget.intercom.io/widget/h5zisg78 https://ajax.cloudflare.com https://js.intercomcdn.com;
style-src 'self' 'unsafe-inline';
img-src 'self' blob: data: https:;
font-src 'self' data: https://cdn.jsdelivr.net;