From 4f060dd11cd8bedcba9e3ee96fce832bd987fe25 Mon Sep 17 00:00:00 2001 From: Morgan Carr <256248948+morgan-coded@users.noreply.github.com> Date: Mon, 8 Jun 2026 15:36:41 -0500 Subject: [PATCH 1/2] Use ServerRouter nonce when nonce prop is not specified (#15170) Co-authored-by: Matt Brophy --- docs/how-to/security.md | 14 +- ...-nonce-default-hydrate-fallback-scripts.md | 1 + .../__tests__/dom/scroll-restoration-test.tsx | 55 +++++++ .../__tests__/dom/ssr/components-test.tsx | 150 ++++++++++++++++++ packages/react-router/lib/dom/lib.tsx | 9 +- .../react-router/lib/dom/ssr/components.tsx | 33 +++- packages/react-router/lib/dom/ssr/entry.ts | 1 + .../lib/dom/ssr/errorBoundaries.tsx | 3 + .../react-router/lib/dom/ssr/fallback.tsx | 4 + packages/react-router/lib/dom/ssr/server.tsx | 6 +- packages/react-router/lib/router/links.ts | 4 +- 11 files changed, 267 insertions(+), 13 deletions(-) create mode 100644 packages/react-router/.changes/patch.fix-nonce-default-hydrate-fallback-scripts.md diff --git a/docs/how-to/security.md b/docs/how-to/security.md index e629f3249b..d3ec9491d1 100644 --- a/docs/how-to/security.md +++ b/docs/how-to/security.md @@ -13,15 +13,17 @@ This is by no means a comprehensive guide, but React Router provides features to ## `Content-Security-Policy` -If you are implementing a [Content-Security-Policy (CSP)][csp] in your application, specifically one using the `unsafe-inline` directive, you will need to specify a [`nonce`][nonce] attribute on the inline `