-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Block builds on vulnerable nextjs versions #447
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||
| import fsExtra from "fs-extra"; | ||||||
| import semVer from "semver"; | ||||||
| import { createRequire } from "node:module"; | ||||||
| import { join, dirname, relative, normalize } from "path"; | ||||||
| import { fileURLToPath } from "url"; | ||||||
|
|
@@ -17,6 +18,21 @@ import { OutputBundleConfig, updateOrCreateGitignore } from "@apphosting/common" | |||||
| // fs-extra is CJS, readJson can't be imported using shorthand | ||||||
| export const { copy, exists, writeFile, readJson, readdir, readFileSync, existsSync, ensureDir } = | ||||||
| fsExtra; | ||||||
| export const { satisfies } = semVer; | ||||||
|
|
||||||
| const SAFE_NEXTJS_VERSIONS = | ||||||
| ">=16.1.0 || ~16.0.7 || ~v15.5.7 || ~v15.4.8 || ~v15.3.6 || ~v15.2.6 || ~v15.1.9 || ~v15.0.5 || <14.3.0-canary.77"; | ||||||
|
|
||||||
| export function checkNextJSVersion(version: string | undefined) { | ||||||
| if (!version) { | ||||||
| return; | ||||||
| } | ||||||
| if (!satisfies(version, SAFE_NEXTJS_VERSIONS)) { | ||||||
| throw new Error( | ||||||
| `CVE-2025-55182: Vulnerable Next version ${version} detected. Deployment blocked. Update your app's dependencies to a patched Next.js version and redeploy: https://nextjs.org/blog/CVE-2025-66478#fixed-versions`, | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error message contains placeholder CVE numbers and a broken link. This will be confusing for users who encounter this error. Please replace If a specific CVE is not yet available, I suggest using a more generic but still helpful message.
Suggested change
|
||||||
| ); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Loads the user's next.config.js file. | ||||||
| export async function loadConfig(root: string, projectRoot: string): Promise<NextConfigComplete> { | ||||||
|
|
||||||
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.
Nit,
<14.3.0-canary.77will match all the 14.3.0 range due to limitations matching canary with semver. That's fine. Safer.