react-router
8.5.1 · 27 Oct 2026MIT80.5M / weekRepositorynpmAtom feed
7.18.6 is the newest release of 7.x.
In short
2 new18 fixed
Security
14 advisories affect 7.8.0; 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
9 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
- HighReact Router has XSS VulnerabilityGHSA-3cgp-3xvw-98x8 · 8 Jan 2026Fixed in 7.9.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.
Minor Changes
Add
nonceprop toLinks&PrefetchPageLinksAdd
loaderDataarguments/properties alongside existingdataarguments/properties to provide consistency and clarity betweenloaderDataandactionDataacross the boardUpdated types:
Route.MetaArgs,Route.MetaMatch,MetaArgs,MetaMatch,Route.ComponentProps.matches,UIMatch@deprecatedwarnings have been added to the existingdataproperties to point users to newloaderDataproperties, in preparation for removing thedataproperties in a future major release
Patch Changes
Prevent "Did not find corresponding fetcher result" console error when navigating during a
fetcher.submitrevalidationBubble client-side middleware errors prior to
nextto the appropriate ancestor error boundarySwitch Lazy Route Discovery manifest URL generation to usea standalone
URLSearchParamsinstance instead ofURL.searchParamsto avoid a major performance bottleneck in ChromeAdjust internal RSC usage of
React.useto avoid Webpack compilation errors when using React 18Remove dependency on
@types/nodein TypeScript declaration filesFix types for
UIMatchto reflect that theloaderData/dataproperties may beundefinedWhen an
ErrorBoundaryis being rendered, not all active matches will have loader data available, since it may have been theirloaderthat threw to trigger the boundaryThe
UIMatch.datatype was not correctly handing this and would always reflect the presence of data, leading to the unexpected runtime errors when anErrorBoundarywas rendered⚠️ This may cause some type errors to show up in your code for unguarded
match.dataaccesses - you should properly guard forundefinedvalues in those scenarios.
// app/root.tsx export function loader() { someFunctionThatThrows(); // ❌ Throws an Error return { title: "My Title" }; } export function Layout({ children }: { children: React.ReactNode }) { let matches = useMatches(); let rootMatch = matches[0] as UIMatch<Awaited<ReturnType<typeof loader>>>; // ^ rootMatch.data is incorrectly typed here, so TypeScript does not // complain if you do the following which throws an error at runtime: let { title } = rootMatch.data; // 💥 return <html>...</html>; }[UNSTABLE] Ensure resource route errors go through
handleErrorw/middleware enabled[UNSTABLE] Propagate returned Response from server middleware if next wasn't called
[UNSTABLE] Allow server middlewares to return
data()values which will be converted into aResponse[UNSTABLE] Update middleware error handling so that the
nextfunction never throws and instead handles any middleware errors at the properErrorBoundaryand returns theResponseup through the ancestornextfunction[UNSTABLE] When middleware is enabled, make the
contextparameter read-only (viaReadonly<unstable_RouterContextProvider>) so that TypeScript will not allow you to write arbitrary fields to it in loaders, actions, or middleware.[UNSTABLE] Rename and alter the signature/functionality of the
unstable_respondAPI instaticHandler.query/staticHandler.queryRouteThe API has been renamed to
unstable_generateMiddlewareResponsefor clarityThe main functional change is that instead of running the loaders/actions before calling
unstable_respondand handing you the result, we now pass aquery/queryRoutefunction as a parameter and you execute the loaders/actions inside your callback, giving you full access to pre-processing and error handlingThe
queryversion of the API now has a signature of(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>The
queryRouteversion of the API now has a signature of(queryRoute: (r: Request) => Promise<Response>) => Promise<Response>This allows for more advanced usages such as running logic before/after calling
queryand direct error handling of errors thrown from query⚠️ This is a breaking change if you've adopted the
staticHandlerunstable_respondAPI
let response = await staticHandler.query(request, { requestContext: new unstable_RouterContextProvider(), async unstable_generateMiddlewareResponse(query) { try { // At this point we've run middleware top-down so we need to call the // handlers and generate the Response to bubble back up the middleware let result = await query(request); if (isResponse(result)) { return result; // Redirects, etc. } return await generateHtmlResponse(result); } catch (error: unknown) { return generateErrorResponse(error); } }, });[UNSTABLE] Convert internal middleware implementations to use the new
unstable_generateMiddlewareResponseAPI[UNSTABLE] Change
getLoadContextsignature (type GetLoadContextFunction) whenfuture.unstable_middlewareis enabled so that it returns anunstable_RouterContextProviderinstance instead of aMapused to contruct the instance internallyThis also removes the
type unstable_InitialContextexport⚠️ This is a breaking change if you have adopted middleware and are using a custom server with a
getLoadContextfunction
[UNSTABLE] Run client middleware on client navigations even if no loaders exist
[UNSTABLE] Change the
unstable_getContextsignature onRouterProvider/HydratedRouter/unstable_RSCHydratedRouterso that it returns anunstable_RouterContextProviderinstance instead of aMapused to contruct the instance internally⚠️ This is a breaking change if you have adopted the
unstable_getContextprop
[UNSTABLE] proxy server action side-effect redirects from actions for document and callServer requests
[UNSTABLE] Fix RSC Data Mode issue where routes that return
falsefromshouldRevalidatewould be replaced by an<Outlet />
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.