-
Notifications
You must be signed in to change notification settings - Fork 67
Chore: Upgrade Next.js and React packages due to CVE-2025-66478 #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: Upgrade Next.js and React packages due to CVE-2025-66478 #95
Conversation
Signed-off-by: Rai Siqueira <rai93siqueira@gmail.com>
Signed-off-by: Rai Siqueira <rai93siqueira@gmail.com>
Reviewer's GuideUpgrades the Next.js/React stack to address a security CVE and aligns project configuration (TypeScript, Next config, middleware/proxy, Tailwind, and pnpm workspace) with the newer tooling expectations. Flow diagram for updated TypeScript, JSX, and Next config pipelineflowchart LR
TSConfig[TSConfig
jsx: react-jsx
moduleResolution: bundler] --> TSCompiler[TypeScript compiler]
TSCompiler --> Turbopack[Turbopack bundler
nextConfig.turbopack]
Turbopack --> ForkTsChecker[ForkTsCheckerWebpackPlugin]
Turbopack --> NextRuntime[Next.js runtime 16.0.7]
NextRuntime --> ReactRuntime[React 19.2.1
ReactDOM 19.2.1]
NextRuntime --> DevTypes[Next dev type files
.next/dev/types]
TailwindConfig[Tailwind config
tailwind.config.js] --> TailwindCLI[Tailwind CLI]
TailwindCLI --> Turbopack
pnpm[pnpm with workspace
pnpm-workspace.yaml] --> TSCompiler
pnpm --> Turbopack
pnpm --> TailwindCLI
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…i-template into chore/upgrade-next-js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- Renaming
middleware.tstoproxy.tsand changing the exported function frommiddlewaretoproxywill disable Next.js middleware routing entirely (Next expects amiddleware.tsfile with amiddlewareexport at the app root), so if this is meant to continue running as middleware it should keep the conventional filename and export name. - Switching from the
webpackproperty toturbopackinnext.config.mjswhile still addingForkTsCheckerWebpackPlugin(a webpack plugin) likely means this config no longer runs as intended; consider either keeping thewebpackconfig hook or adopting a Turbopack-compatible approach for type-checking.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Renaming `middleware.ts` to `proxy.ts` and changing the exported function from `middleware` to `proxy` will disable Next.js middleware routing entirely (Next expects a `middleware.ts` file with a `middleware` export at the app root), so if this is meant to continue running as middleware it should keep the conventional filename and export name.
- Switching from the `webpack` property to `turbopack` in `next.config.mjs` while still adding `ForkTsCheckerWebpackPlugin` (a webpack plugin) likely means this config no longer runs as intended; consider either keeping the `webpack` config hook or adopting a Turbopack-compatible approach for type-checking.
## Individual Comments
### Comment 1
<location> `nextjs-frontend/next.config.mjs:5-8` </location>
<code_context>
/** @type {import('next').NextConfig} */
const nextConfig = {
- webpack: (config, { isServer }) => {
+ turbopack: (config, { isServer }) => {
if (!isServer) {
config.plugins.push(
new ForkTsCheckerWebpackPlugin({
</code_context>
<issue_to_address>
**issue (bug_risk):** Using `turbopack` instead of `webpack` here is likely unsupported and breaks the ForkTsChecker setup.
NextConfig doesn’t expose a `turbopack` hook equivalent to `webpack`, and `ForkTsCheckerWebpackPlugin` only works with webpack. With this change, Next will ignore the function so the type-checking plugin never runs. Keep this under `webpack` if you still rely on this plugin, or find a different solution for incremental type-checking when using Turbopack.
</issue_to_address>
### Comment 2
<location> `nextjs-frontend/tsconfig.json:17` </location>
<code_context>
"resolveJsonModule": true,
"isolatedModules": true,
- "jsx": "preserve",
+ "jsx": "react-jsx",
"incremental": true,
"plugins": [
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Switching `jsx` from `preserve` to `react-jsx` can conflict with Next’s own JSX/SWC handling.
Next’s toolchain (via SWC) generally assumes `"jsx": "preserve"` so it can own the JSX transform, particularly around app router and server/client component boundaries. Moving this to `"react-jsx"` shifts that work into TypeScript and can introduce subtle runtime/build issues. Please confirm this aligns with Next 16’s guidance and your bundling behavior; otherwise, consider keeping `"jsx"` as `"preserve"`.
```suggestion
"jsx": "preserve",
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "jsx": "preserve", | ||
| "jsx": "react-jsx", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Switching jsx from preserve to react-jsx can conflict with Next’s own JSX/SWC handling.
Next’s toolchain (via SWC) generally assumes "jsx": "preserve" so it can own the JSX transform, particularly around app router and server/client component boundaries. Moving this to "react-jsx" shifts that work into TypeScript and can introduce subtle runtime/build issues. Please confirm this aligns with Next 16’s guidance and your bundling behavior; otherwise, consider keeping "jsx" as "preserve".
| "jsx": "react-jsx", | |
| "jsx": "preserve", |
fjsj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, please check comments
Signed-off-by: Rai Siqueira <rai93siqueira@gmail.com>
Signed-off-by: Rai Siqueira <rai93siqueira@gmail.com>
|
@raisiqueira could you fix the conflicts and follow the release process? |
…tapi-template into chore/upgrade-next-js
Signed-off-by: Rai Siqueira <rai93siqueira@gmail.com>
Signed-off-by: Rai Siqueira <rai93siqueira@gmail.com>
|
@andersonresende Done ✅ |
|
Thanks! I'll approve! |
Description
Upgraded the Next.js and React packages due to a CVE that allows remote code execution.
Motivation and Context
Screenshots (if appropriate):
Steps to reproduce (if appropriate):
Types of changes
Checklist:
Summary by Sourcery
Upgrade the Next.js frontend stack to the latest Next/React versions and align project config with the new tooling requirements.
Build: