react-router
8.5.1 · 27 Oct 2026MIT80.5M / weekRepositorynpmAtom feed
7.18.6 is the newest release of 7.x.
In short
1 new1 fixed
Security
13 advisories affect 7.9.4; 7.18.0 fixes them
- HighReact Router: Unauthenticated Denial of Service via Inefficient Route MatchingGHSA-chx6-hx7r-mcp5 · 24 Jul 2026Fixed in 7.18.0
- HighReact Router vulnerable to Denial of Service via reflected user input in single-fetchGHSA-rxv8-25v2-qmq8 · 4 Jun 2026Fixed in 7.14.0
- HighReact Router vulnerable to DoS via unbounded path expansion in __manifest endpointGHSA-8x6r-g9mw-2r78 · 3 Jun 2026Fixed in 7.15.0
- HighReact Router's vendored turbo-stream v2 allows arbitrary constructor invocation via TYPE_ERROR deserialization leading to Unauth RCEGHSA-49rj-9fvp-4h2h · 3 Jun 2026Fixed in 7.14.2
- HighReact Router vulnerable to XSS in unstable RSC redirect handling via javascript: redirect targetsGHSA-8646-j5j9-6r62 · 3 Jun 2026Fixed in 7.13.2
8 more
- HighReact Router vulnerable to XSS via Open RedirectsGHSA-2w69-qvjg-hvjx · 8 Jan 2026Fixed in 7.12.0
- HighReact Router SSR XSS in ScrollRestorationGHSA-8v8x-cx79-35w7 · 8 Jan 2026Fixed in 7.12.0
- ModerateReact Router: Open redirect via backslash in <Link> and useNavigate (CVE-2025-68470 bypass)GHSA-wrjc-x8rr-h8h6 · 23 Jul 2026Fixed in 7.18.0
- ModerateReact Router: Arbitrary Constructor Injection via deserializeErrors() in React Router SSR HydrationGHSA-337j-9hxr-rhxg · 23 Jul 2026Fixed in 7.18.0
- ModerateReact Router's same-origin redirect with path starting // causes open redirect via protocol-relative URL reinterpretationGHSA-2j2x-hqr9-3h42 · 3 Jun 2026Fixed in 7.14.1
- ModerateReact Router has stored XSS via unescaped Location header in prerendered redirect HTMLGHSA-f22v-gfqf-p8f3 · 3 Jun 2026Fixed in 7.13.2
- ModerateReact Router has CSRF issue in Action/Server Action Request ProcessingGHSA-h5cw-625j-3rxh · 8 Jan 2026Fixed in 7.12.0
- ModerateReact Router has unexpected external redirect via untrusted pathsGHSA-9jcx-v3wj-wh4m · 8 Jan 2026Fixed in 7.9.6
Release note
The section about react-router of a note shared by several packages.
Patch Changes
Handle external redirects in from server actions
New (unstable)
useRoutehook for accessing data from specific routesFor example, let's say you have an
adminroute somewhere in your app and you want any child routes ofadminto all have access to theloaderDataandactionDatafromadmin.// app/routes/admin.tsx import { Outlet } from "react-router"; export const loader = () => ({ message: "Hello, loader!" }); export const action = () => ({ count: 1 }); export default function Component() { return ( <div> {/* ... */} <Outlet /> {/* ... */} </div> ); }You might even want to create a reusable widget that all of the routes nested under
admincould use:import { unstable_useRoute as useRoute } from "react-router"; export function AdminWidget() { // How to get `message` and `count` from `admin` route? }In framework mode,
useRouteknows all your app's routes and gives you TS errors when invalid route IDs are passed in:export function AdminWidget() { const admin = useRoute("routes/dmin"); // ^^^^^^^^^^^ }useRoutereturnsundefinedif the route is not part of the current page:export function AdminWidget() { const admin = useRoute("routes/admin"); if (!admin) { throw new Error(`AdminWidget used outside of "routes/admin"`); } }Note: the
rootroute is the exception since it is guaranteed to be part of the current page.
As a result,useRoutenever returnsundefinedforroot.loaderDataandactionDataare marked as optional since they could be accessed before theactionis triggered or after theloaderthrew an error:export function AdminWidget() { const admin = useRoute("routes/admin"); if (!admin) { throw new Error(`AdminWidget used outside of "routes/admin"`); } const { loaderData, actionData } = admin; console.log(loaderData); // ^? { message: string } | undefined console.log(actionData); // ^? { count: number } | undefined }If instead of a specific route, you wanted access to the current route's
loaderDataandactionData, you can calluseRoutewithout arguments:export function AdminWidget() { const currentRoute = useRoute(); currentRoute.loaderData; currentRoute.actionData; }This usage is equivalent to calling
useLoaderDataanduseActionData, but consolidates all route data access into one hook:useRoute.Note: when calling
useRoute()(without a route ID), TS has no way to know which route is the current route.
As a result,loaderDataandactionDataare typed asunknown.
If you want more type-safety, you can either narrow the type yourself with something likezodor you can refactor your app to pass down typed props to yourAdminWidget:export function AdminWidget({ message, count, }: { message: string; count: number; }) { /* ... */ }
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.