From 7f0fb8b3280f86fc5b9e94acbf77792839ca04d6 Mon Sep 17 00:00:00 2001 From: groovecoder Date: Wed, 3 Jul 2024 10:38:37 -0500 Subject: [PATCH] MPP-3838: restore safer CSP Use a new EagerNonceCSPMiddleware to add nonce to the CSP and update the React app to include it in dynamic scripts. --- frontend/src/components/layout/Layout.tsx | 2 + privaterelay/middleware.py | 52 +++++++++++++++++++++++ privaterelay/settings.py | 20 ++++++--- pyproject.toml | 1 + 4 files changed, 68 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/layout/Layout.tsx b/frontend/src/components/layout/Layout.tsx index 2b48c9e62..e8f93c635 100644 --- a/frontend/src/components/layout/Layout.tsx +++ b/frontend/src/components/layout/Layout.tsx @@ -34,6 +34,7 @@ import { HolidayPromoBanner } from "./topmessage/HolidayPromoBanner"; import { isFlagActive } from "../../functions/waffle"; import { useMetrics } from "../../hooks/metrics"; import { GoogleAnalyticsWorkaround } from "../GoogleAnalyticsWorkaround"; +import { getCookie } from "../../functions/cookies"; export type Props = { children: ReactNode; @@ -293,6 +294,7 @@ export const Layout = (props: Props) => { metricsEnabled === "enabled" ? (