Skip to content

Conversation

@leoortizz
Copy link
Member

@leoortizz leoortizz commented Dec 3, 2025

Description

This PR blocks the deployment of Next.js applications that are vulnerable to CVE-2025-66478 (Remote Code Execution in React Server Components).

Affected deployments are those using:

  1. Next.js App Router (/app directory)
  2. Server-side features requiring a backend (Cloud Functions)
  3. Vulnerable Next.js versions:
    • 15.x: < 15.0.5, < 15.1.9, < 15.2.6, < 15.3.6, < 15.4.8, < 15.5.7
    • 16.x: < 16.0.7
    • 14.x: Canary releases >= 14.3.0-canary.77

Changes:

  • Added isNextJsVersionVulnerable utility in src/frameworks/next/utils.ts to check against the specific vulnerable semver ranges.
  • Updated src/frameworks/next/index.ts to throw a FirebaseError during the build step if a vulnerable version is detected when wantsBackend is true.
  • Added comprehensive unit tests in src/frameworks/next/utils.spec.ts.

Scenarios Tested

  • Unit Tests: Verified isNextJsVersionVulnerable against a matrix of versions:
    • Blocked: 15.0.0, 15.1.0, 15.4.7, 16.0.6, 14.3.0-canary.77.
    • Allowed (Patched): 15.0.5, 15.1.9, 16.0.7.
    • Allowed (Future): Verified that future minor versions (e.g., 15.6.0) are treated as safe/patched.
    • Allowed (Stable/Legacy): Stable 14.x and older versions (13.x) are not blocked.

Sample Commands

This change affects firebase deploy behavior for Next.js projects.

# If using a vulnerable version (e.g. 16.0.0):
$ firebase deploy

...

Error: Next.js version 16.0.0 is vulnerable to CVE-2025-66478.
Please upgrade to a patched version: 16.0.7+.
See https://nextjs.org/blog/CVE-2025-66478 for more details.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @leoortizz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This change enhances the security posture of Next.js application deployments by integrating a proactive check against a known vulnerability (CVE-2025-66478). It ensures that applications using the App Directory and requiring backend services are not deployed if they are running an unpatched Next.js version, thereby protecting users from potential security risks. The implementation provides clear feedback and actionable steps for developers to resolve the issue.

Highlights

  • Security Vulnerability Prevention: This pull request introduces a critical security measure to prevent the deployment of Next.js applications that are vulnerable to CVE-2025-66478.
  • Deployment Blocking Logic: During the build process, if a Next.js application uses the App Directory, requires a backend, and is detected to be running a vulnerable version of Next.js, the deployment will now be blocked with a FirebaseError.
  • Version Detection and Validation: New utility functions have been added to accurately retrieve the raw Next.js version and to determine if that version falls within the known vulnerable ranges for CVE-2025-66478, including specific patch levels for various minor versions and canary releases.
  • User Guidance: The error message provided when a vulnerable version is detected includes clear instructions for users to upgrade to a patched version or downgrade to a stable Next.js 14.x release, along with a link to the official Next.js blog post for more details.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a critical security check for Next.js applications, preventing deployments of versions vulnerable to CVE-2025-66478. The changes include adding utility functions to detect vulnerable Next.js versions and integrating this check into the build process. Tests for the new utility functions have also been added, ensuring the logic for version detection is robust. The overall approach is sound and addresses a significant security concern.

Updated the error handling to provide a more detailed and version-specific message when a vulnerable Next.js version is detected. The message now specifies the required patched versions based on the major version of Next.js, enhancing clarity for users on how to resolve the issue.
Added references to CVE-2025-66478 and CVE-2025-55182 in the documentation for the Next.js version vulnerability check function. This provides users with direct links to relevant security advisories, improving awareness and guidance on addressing potential vulnerabilities.
@leoortizz leoortizz enabled auto-merge (squash) December 3, 2025 22:03
@leoortizz leoortizz disabled auto-merge December 3, 2025 22:16
@leoortizz leoortizz enabled auto-merge (squash) December 3, 2025 22:18
@taeold taeold disabled auto-merge December 3, 2025 23:42
@joehan joehan merged commit 763951a into master Dec 3, 2025
47 of 48 checks passed
@joehan joehan deleted the leoortizz_nextjsCVE-2025-66478 branch December 3, 2025 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants