Moderate Vulnerability: PostCSS XSS Exposure via Vulnerable Dependency in Next.js #93718
Replies: 8 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. |
|
this temporary rule in |
|
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. |
|
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? |
|
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
|
|
No, this is not just happening on your end — this affects everyone using Next.js between versions 9.3.4-canary.0 and 16.3.0-canary.5, so you're not alone. Here's the full picture and what to actually do about it. What's actually happeningThis is a real, confirmed vulnerability — not a false positive. The advisory
Next.js bundles What NOT to doDo not run The correct fix — use npm
|
| What | Detail |
|---|---|
| Affected range | Next.js 9.3.4-canary.0 through 16.3.0-canary.5 |
| Root cause | Next.js bundles postcss@8.4.31; fixed version is 8.5.10+ |
| Advisory | GHSA-qx2v-qp2m-jg93 / CVE-2026-41305 (Moderate, 6.1) |
@next/third-parties additional vector |
Pins next@16.3.0-canary.14 in its own devDeps, same issue |
| Wrong fix | npm audit fix --force — downgrades Next.js to 9.3.3, never do this |
| Correct fix | Add "overrides": { "postcss": "^8.5.10" } to package.json |
Hope this helps — if it answers your question, would you mind clicking "Mark as answer" so others searching for the same thing can find it quickly?
|
I'd like to close this issue because it has been resolved on my end after upgrading to |
|
One improvement to the suggested workaround is to scope the override to Next.js instead of applying it globally. Instead of: {
"overrides": {
"postcss": "^8.5.10"
}
}consider: {
"overrides": {
"next": {
"postcss": "^8.5.10"
}
}
}This has a couple of benefits:
|
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
All reactions