Scheduling infrastructure for absolutely everyone.
fix: Avoid CSP related warnings in console on booking pages. (#14072)
Hariom Balhara8fe8beb6866e
diff --git a/.env.example b/.env.exampleindex 17f4d19cc42..9d3259b3287 100644--- a/.env.example+++ b/.env.example@@ -232,6 +232,7 @@ NEXT_PUBLIC_COMPANY_NAME="Cal.com, Inc."# NEXT_PUBLIC_DISABLE_SIGNUP=trueNEXT_PUBLIC_DISABLE_SIGNUP=+# Set this to 'non-strict' to enable CSP for support pages. 'strict' isn't supported yet. Also, check the README for details.# Content Security PolicyCSP_POLICY=diff --git a/apps/web/lib/csp.ts b/apps/web/lib/csp.tsindex c28a9429dd3..03fbabe9622 100644--- a/apps/web/lib/csp.ts+++ b/apps/web/lib/csp.ts@@ -84,7 +84,14 @@ export function csp(req: IncomingMessage | NextRequest | null, res: OutgoingMessconst enforced ="cache" in req ? req.headers.get("x-csp-enforce") === "true" : req.headers["x-csp-enforce"] === "true";- const name = enforced ? "Content-Security-Policy" : "Content-Security-Policy-Report-Only";+ // No need to enable REPORT ONLY mode for CSP unless we start actively working on it. See https://github.com/calcom/cal.com/issues/13844+ const name = enforced ? "Content-Security-Policy" : /*"Content-Security-Policy-Report-Only"*/ null;++ if (!name) {+ return {+ nonce: undefined,+ };+ }const value = getCspPolicy(nonce).replace(/\s{2,}/g, " ")