The React Router team has disclosed seven security vulnerabilities in React Router. Most have limited impact on Netlify, but if your site uses React Router, you should update it. If your site doesn't use React Router, you don't need to do anything. Am I affected? Your site may be affected if it uses React Router 6, 7, or 8, either directly or through a framework built on it. These frameworks include, but aren't limited to:
Continue reading...
- Remix 2, which uses React Router 6
- Shopify Hydrogen, which uses React Router 7
- In your site's folder, install your dependencies, then list the installed React Router packages, using the commands for your package manager in the table below. In a monorepo, run them in the folder of the site you deploy, not the repository root. This lists every installed copy and its version, including copies that another framework, such as Remix 2, brings in. It only sees installed packages, so install first.
- This checks the code in your project folder, not what's deployed. Older deploys keep running the code they were built with, as explained under "What should I do?".
- You can also open your project's package.json file and look for react-router or packages starting with @react-router/. A framework built on React Router may not list it there, so listing the installed packages is more reliable.
- If an AI tool built your site and you're not sure, ask it: "Does this project use React Router, directly or through another package? If so, which version?"
- If you have a Credit plan with Agent Runners, you can ask the same question in Ask mode .
- Check that your package.json lists React Router packages with a ^ or ~ version range, such as ^7.17.0. A range such as * lets the update move you to a new major version, which can include breaking changes.
- In the same folder, run the update command for your package manager from the table above. With npm and pnpm, it only installs versions that your package.json allows, so it keeps you on your current major version. With Yarn, install the patched version for your current major version.
- List the installed versions again and compare each package with its patched version below. If any are still affected:
- If the affected copy is nested under another package, such as react-router-dom or a framework, update that package. Installing react-router on its own doesn't replace a copy that another package pins.
- Otherwise, install a patched version directly, such as react-router@^7.18.6 or react-router@^8.5.1, and do the same for any @react-router/ packages you use. Then list the installed versions again to confirm every copy is patched.
- Commit every file the update changed, including package.json and your lockfile, such as package-lock.json, pnpm-lock.yaml, or yarn.lock, then deploy.
- react-router 8.5.1 or later (for React Router 8.x)
- react-router 7.18.5 or later (for React Router 7.x)
- @react-router/node, @react-router/serve, and @react-router/dev 8.5.1 or later (for React Router 8.x)
- @react-router/node and @react-router/serve 7.18.6 or later (for React Router 7.x)
- React Router security advisories
Continue reading...