Skip to content

refactor(functions-backend): modernize functions emulator and remove dead functions-emulator dependency#16385

Open
inlined wants to merge 4 commits into
mainfrom
security-audit/firebase-functions-backend
Open

refactor(functions-backend): modernize functions emulator and remove dead functions-emulator dependency#16385
inlined wants to merge 4 commits into
mainfrom
security-audit/firebase-functions-backend

Conversation

@inlined

@inlined inlined commented Jul 10, 2026

Copy link
Copy Markdown
Member

Security Audit & Remediation: firebase-functions-backend

A. Previous CVEs

Resolved 30 vulnerabilities (20 High, 1 Critical) by purging the deprecated @google-cloud/functions-emulator:

B. Changes Made

  • Purged the deprecated @google-cloud/functions-emulator ("dead cloud emulator") devDependency from package.json.
  • Created firebase.json configuration file to run the Functions Emulator on port 5005.
  • Rewrote the startup/ready-checking script from Bash (start.sh) into a robust cross-platform Node.js script (start.js) and updated CI workflow references and README instructions to invoke it directly.

C. Benefits of the Node.js Script over Bash

  1. Deterministic Ready-Checking: Instead of using shell-level curl polling which can yield false positives or fail due to network redirect/error states, start.js performs raw TCP dials using standard net.Socket to verify the emulator is listening on port 5005.
  2. Robust Process Management: Detaching and running the background emulator in synchronous mode is handled cleanly using Node's native process spawning APIs (detached: true and child.unref()), preventing the background process from being killed by shell-hangup signals (SIGHUP) during runner step transitions.
  3. Unified Language: Since the Cloud Functions emulated code (index.js) is written in JavaScript, managing the emulator using Node.js keeps the stack consistent for SDK maintainers.

D. Remaining CVEs

  • 9 moderate severity vulnerabilities caused transitively by uuid < 11.1.1 (required by firebase-admin).

E. Introduced CVEs

  • None

F. Testing Strategy

  • Verified JS syntax of the functions using node --check - 100% passing.
  • Installed package dependencies using npm install and verified all packages resolved cleanly.

@gemini-code-assist

Copy link
Copy Markdown
Contributor
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 the 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 counterproductive. 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.

@wiz-9635d3485b

wiz-9635d3485b Bot commented Jul 10, 2026

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities 1 Medium
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 1 Medium
Software Management Finding Software Management Findings -
Total 2 Medium

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@inlined
inlined requested a review from a team as a code owner July 13, 2026 23:47
@danger-firebase-ios

Copy link
Copy Markdown
1 Warning
⚠️ Did you forget to add a changelog entry? (Add #no-changelog to the PR description to silence this warning.)

Generated by 🚫 Danger

@paulb777

Copy link
Copy Markdown
Member

@inlined The CI issues should be resolved before review. Would you like assistance?

@inlined

inlined commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

Sorry, I got pulled into Extensions/Functions stuff and have had trouble getting XCode tools all ready. I'll get to this today

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.

2 participants