Moderate Vulnerability: PostCSS XSS Exposure via Vulnerable Dependency in Next.js #93718
Replies: 5 comments
-
|
Just so you know there's a known issue that affects pretty much everyone using Next.js between versions 9.3.4-canary.0 and 16.3.0-canary.5. The real problem is in PostCSS (<8.5.10), which sneaks in as a transitive dependency. Just upgrade to Next.js 14.2.5 or higher. The fix is already being included in the next canary releases. Whatever you do, don't run npm audit fix --force — seriously, don't. It'll downgrade your Next.js to version 9.3.3 and most likely break your app. No panic though. This one's considered moderate and only messes with CSS processing during build time. |
Beta Was this translation helpful? Give feedback.
-
|
this temporary rule in |
Beta Was this translation helpful? Give feedback.
-
|
This is a known issue affecting Next.js users. Here's a comprehensive summary: The ProblemThe PostCSS vulnerability (CVE) is in a transitive dependency. Even if you don't use PostCSS directly, Next.js uses it internally for CSS processing. Immediate FixAdd this to your {
"overrides": {
"postcss": "^8.5.10"
}
}Then run: npm install
npm audit # Verify the vulnerability is resolvedFor Yarn users{
"resolutions": {
"postcss": "^8.5.10"
}
}For pnpm users{
"pnpm": {
"overrides": {
"postcss": "^8.5.10"
}
}
}Verify the fix# Check if the vulnerability persists
npm audit --audit-level=moderate
# Verify postcss version
npm ls postcssLong-termThe Next.js team is aware of this. Watch for the next patch release which should update the PostCSS dependency automatically. Note: This is a dev-time vulnerability (PostCSS runs during build), so production runtime risk is lower. But it's still important to patch for CI/CD security. |
Beta Was this translation helpful? Give feedback.
-
|
There have been a few patch releases to 16.2 since this issue was raised. Will it be addressed in that minor version, or only in 16.3? |
Beta Was this translation helpful? Give feedback.
-
|
This affects other users as well when a dependency tree includes a vulnerable version of a transitive dependency (in this case, To resolve this issue, you can force the package manager to resolve Depending on the package manager you use, add the following to your 1. If using npmAdd the "overrides": {
"postcss": "^8.5.10"
}2. If using pnpmAdd the "pnpm": {
"overrides": {
"postcss": "^8.5.10"
}
}3. If using YarnAdd the "resolutions": {
"postcss": "^8.5.10"
}Next Steps:After adding the override to your
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Is this issue only happening on my end, or does it affect other users as well?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions