-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Block vulnerable nextjs versions. #442
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 all commits
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`, | ||
| ); | ||
|
Comment on lines
+31
to
+33
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 CVE identifiers and URL in the error message appear to be placeholders and are likely incorrect. To avoid providing misleading information, consider using a more generic error message until the correct CVE details and a valid advisory link are available. throw new Error(
`Vulnerable Next.js version ${version} detected. Deployment blocked. Please update your app's dependencies to a patched Next.js version and redeploy. For more details, see the relevant security advisory.`,
); |
||
| } | ||
| } | ||
|
|
||
| // Loads the user's next.config.js file. | ||
| export async function loadConfig(root: string, projectRoot: string): Promise<NextConfigComplete> { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.