react-router
8.5.1 · 27 Oct 2026MIT80.5M / weekRepositorynpmAtom feed
7.18.6 is the newest release of 7.x.
In short
3 new7 fixed6 changed
Security
14 advisories affect 7.2.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 via Open RedirectsGHSA-2w69-qvjg-hvjx · 8 Jan 2026Fixed in 7.12.0
9 more
- 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
- HighReact Router allows pre-render data spoofing on React-Router framework modeGHSA-cpj6-fhp6-mr6j · 24 Apr 2025Fixed in 7.5.2
- HighReact Router allows a DoS via cache poisoning by forcing SPA modeGHSA-f46r-rw29-r322 · 24 Apr 2025Fixed in 7.5.2
- 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 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
New type-safe
hrefutility that guarantees links point to actual paths in your appimport { href } from "react-router"; export default function Component() { const link = href("/blog/:slug", { slug: "my-first-post" }); return ( <main> <Link to={href("/products/:id", { id: "asdf" })} /> <NavLink to={href("/:lang?/about", { lang: "en" })} /> </main> ); }
Patch Changes
Fix typegen for repeated params
In React Router, path parameters are keyed by their name.
So for a path pattern like/a/:id/b/:id?/c/:id, the last:idwill set the value foridinuseParamsand theparamsprop.
For example,/a/1/b/2/c/3will result in the value{ id: 3 }at runtime.Previously, generated types for params incorrectly modeled repeated params with an array.
So/a/1/b/2/c/3generated a type like{ id: [1,2,3] }.To be consistent with runtime behavior, the generated types now correctly model the "last one wins" semantics of path parameters.
So/a/1/b/2/c/3now generates a type like{ id: 3 }.Don't apply Single Fetch revalidation de-optimization when in SPA mode since there is no server HTTP request
Properly handle revalidations to across a prerender/SPA boundary
In "hybrid" applications where some routes are pre-rendered and some are served from a SPA fallback, we need to avoid making
.datarequests if the path wasn't pre-rendered because the request will 404We don't know all the pre-rendered paths client-side, however:
All
loaderdata inssr:falsemode is static because it's generated at build timeA route must use a
clientLoaderto do anything dynamicTherefore, if a route only has a
loaderand not aclientLoader, we disable revalidation by default because there is no new data to retrieveWe short circuit and skip single fetch
.datarequest logic if there are no server loaders withshouldLoad=truein our single fetchdataStrategyThis ensures that the route doesn't cause a
.datarequest that would 404 after a submission
Error at build time in
ssr:false+prerenderapps for the edge case scenario of:A parent route has only a
loader(does not have aclientLoader)The parent route is pre-rendered
The parent route has children routes which are not prerendered
This means that when the child paths are loaded via the SPA fallback, the parent won't have any
loaderDatabecause there is no server on which to run theloaderThis can be resolved by either adding a parent
clientLoaderor pre-rendering the child pathsIf you add a
clientLoader, calling theserverLoader()on non-prerendered paths will throw a 404
Add unstable support for splitting route modules in framework mode via
future.unstable_splitRouteModulesAdd
unstable_SerializesTobrand type for library authors to register types serializable by React Router's streaming format (turbo-stream)Align dev server behavior with static file server behavior when
ssr:falseis setWhen no
prerenderconfig exists, only SSR down to the rootHydrateFallback(SPA Mode)When a
prerenderconfig exists but the current path is not prerendered, only SSR down to the rootHydrateFallback(SPA Fallback)Return a 404 on
.datarequests to non-pre-rendered paths
Improve prefetch performance of CSS side effects in framework mode
Disable Lazy Route Discovery for all
ssr:falseapps and not just "SPA Mode" because there is no runtime server to serve the search-param-configured__manifestrequestsWe previously only disabled this for "SPA Mode" which is
ssr:falseand noprerenderconfig but we realized it should apply to allssr:falseapps, including those prerendering multiple pagesIn those
prerenderscenarios we would prerender the/__manifestfile assuming the static file server would serve it but that makes some unneccesary assumptions about the static file server behaviors
Properly handle interrupted manifest requests in lazy route discovery
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.