You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
functions: pre-deploy audit fails again (proxy-addr critical, node-forge high) — upgrade firebase-admin 12→14 and firebase-functions 5→7 #88
npm run audit in functions/ (the pre-deploy check in CLAUDE.md) has failed at --audit-level=high since early October 2026. package-lock.json hasn't changed: the advisories were published after the last passing run on 2026-10-02. Registry signatures still verify (574 packages), so these are ordinary advisories, not malware.
proxy-addr@2.0.7 (critical), GHSA-jqcg-44mw-7w3h: IP spoofing via an IPv4-mapped IPv6 trust subnet. It comes in through firebase-functions@5.1.1 → express@4.22.2, which asks for ~2.0.7. The in-range fix 2.0.8 was published 2026-09-15, so it already clears the 7-day rule, and a lockfile-only bump fixes it.
node-forge@1.4.0 (high), GHSA-86w9-cpqp-85rv: RSA PKCS#1 v1.5 signature verification accepts extra nested DigestAlgorithm elements. It comes in through firebase-admin@12.7.0 (^1.3.1). No fixed version exists: 1.4.0 is the latest release. firebase-admin 14 no longer depends on node-forge, so the only way to clear this is the major upgrade.
Moderate: qs (needs 6.16, outside express's ~6.15.1), uuid (needs a major), @fastify/busboy (3.2.2 is in range and older than 7 days).
These are dev-only, so --omit=dev doesn't list them: handlebars (2× critical), braces (high) and sprintf-js, all through jest/istanbul.
Already live
All 21 functions run this lockfile. searchVetClinics was redeployed alone on 2026-10-13 with the audit failing. That was a deliberate decision: the deploy neither added nor removed any exposure.
To do
proxy-addr → 2.0.8 in the lockfile only (npm update proxy-addr). Confirm npm ls proxy-addr --omit=dev shows 2.0.8.
firebase-admin 12.7.0 → 14.x, a major upgrade (two majors). Latest is 14.5.0, published 2026-09-23, so it clears the 7-day rule. It requires Node >=22; the runtime is nodejs24.
Read the 13 and 14 changelogs. Pay attention to Firestore (FieldValue, Timestamp, GeoPoint), Messaging (sendEach), Auth (getUser, deleteUser) and Storage, which index.ts, moderation.ts, removeSignal.ts and signalOwnership.ts use.
firebase-functions 5.1.1 → 7.x (latest 7.4.0, published 2026-09-15). Its peer range accepts firebase-admin ^14. Check the v2 onCall, onDocument*, onSchedule and defineSecret APIs for breaking changes.
Use npm install --before=$(date -v-7d +%Y-%m-%d) firebase-admin@14 firebase-functions@7, then rm -rf node_modules && npm ci && npm run build && npm test && npm run audit.
Run firestore-tests (npm test) as well. It doesn't use firebase-admin, but rules deploys share the gate.
Do a full functions deploy from merged dev. Every function bundles these deps, so redeploying a subset leaves the rest exposed. Then smoke-test on a device:
The plan above is valid and safe to do from a supply-chain point of view. Two parts of it are understated, though, and as written it would neither compile nor turn npm run audit green.
Confirmed
Both advisories are real, and the dependency paths match npm ls: GHSA-jqcg-44mw-7w3h was published 2026-10-05, and GHSA-86w9-cpqp-85rv on 2026-09-03 with no patched node-forge.
All target versions clear the 7-day rule:
proxy-addr 2.0.8 (2026-09-15)
firebase-admin 14.5.0 (2026-09-23)
firebase-functions 7.4.0 (2026-09-15)
proxy-addr 2.0.8 is genuine, despite being the first release in five years:
It was published via npm trusted publishing (GitHub Actions OIDC) with SLSA provenance from jshttp/proxy-addr@refs/tags/v2.0.8 (a11ad82).
The tarball diff against 2.0.7 is the IPv4-mapped canonicalisation fix in index.js, plus README/HISTORY/devDependency churn.
It adds no install script and has the same runtime dependencies.
A lockfile-only dry run (npm install --package-lock-only --ignore-scripts --before=<7d> firebase-admin@14 firebase-functions@7, which fetches metadata only and runs no package code) leaves npm audit --omit=dev at 0 critical / 0 high / 3 moderate. The moderates are @fastify/busboy and uuid via gaxios@6, and both have in-range fixes.
Neither advisory is reachable today, so this is about unblocking the gate, not an active exposure:
proxy-addr only matters with Express trust proxy configured. Neither firebase-functions nor our code sets it, and nothing reads req.ip.
firebase-admin 12 calls node-forge only from credential-internal.js (privateKeyFromPem for cert() credentials). We use ADC (admin.initializeApp() with no arguments), so the vulnerable signature-verification path is never hit.
About 50 references across index.ts, moderation.ts, signalOwnership.ts, removeSignal.ts and signalRefs.ts must move to modular imports: admin.firestore(), admin.firestore.FieldValue/Timestamp/GeoPoint/DocumentReference/…, admin.messaging() / admin.messaging.Message, and admin.auth().
The replacements are getFirestore(), FieldValue/Timestamp/GeoPoint from firebase-admin/firestore, getMessaging() from firebase-admin/messaging, and getAuth() from firebase-admin/auth. initializeApp is still exported from the root.
This is most of the work. tsc flags every site, so nothing fails silently. The modular API already exists on v12, so the migration can land and deploy first, on its own, before any version changes.
npm run audit still fails after the upgrade, because of dev dependencies. The script has no --omit=dev, so these remain:
handlebars 4.7.9: critical, via ts-jest. The in-range fix is 4.7.10, published 2026-10-05.
braces 3.0.3: high, via jest@29 → micromatch. No fixed braces exists, so this needs jest 30 (30.5.2 was published 2026-09-18) along with matching ts-jest/@types/jest.
The alternative is to scope the gate to what ships (npm audit --omit=dev --audit-level=high). That needs a decision either way.
Step 1 is subsumed by step 3.firebase-functions 7 depends on express@^5.2.1, which resolves proxy-addr@2.0.8 and qs@6.16.0 by itself. Step 1 is still worth doing on its own if we want a deploy before the majors land.
10.0.15 (2026-10-05) is the newest past quarantine.
10.0.16 (2026-10-07) clears it on 2026-10-14.
10.1.0 (2026-10-10) clears it on 2026-10-17.
Checked, no action needed
Express 5 compatibility:signalLink (the only onRequest) uses res.redirect(301, url), res.status(200).send() and req.query, all of which are valid in Express 5.
Whether req.query comes from qs or the simple parser, the typeof rawLang === "string" guard and the extraneous-key check still redirect ?lang=a&lang=b and ?lang[x]=y.
FCM error codes: the stale-token cleanup (index.ts:254) compares messaging/registration-token-not-registered / messaging/invalid-registration-token, and v14's FirebaseMessagingError still builds code as messaging/${code}.
Tests: none of them mock firebase-admin, so the namespace migration won't silently pass a mocked suite. Build and runtime smoke tests are what catch it.
Suggested order
Commit A (no version changes): migrate to the modular Admin API on firebase-admin 12, then build, run the tests, and do a full deploy.
Activity
BurningAXE commentedon Oct 13, 2026
Vetting (2026-10-13)
The plan above is valid and safe to do from a supply-chain point of view. Two parts of it are understated, though, and as written it would neither compile nor turn
npm run auditgreen.Confirmed
npm ls: GHSA-jqcg-44mw-7w3h was published 2026-10-05, and GHSA-86w9-cpqp-85rv on 2026-09-03 with no patchednode-forge.proxy-addr2.0.8 (2026-09-15)firebase-admin14.5.0 (2026-09-23)firebase-functions7.4.0 (2026-09-15)proxy-addr2.0.8 is genuine, despite being the first release in five years:jshttp/proxy-addr@refs/tags/v2.0.8(a11ad82).index.js, plus README/HISTORY/devDependency churn.npm install --package-lock-only --ignore-scripts --before=<7d> firebase-admin@14 firebase-functions@7, which fetches metadata only and runs no package code) leavesnpm audit --omit=devat 0 critical / 0 high / 3 moderate. The moderates are@fastify/busboyanduuidviagaxios@6, and both have in-range fixes.proxy-addronly matters with Expresstrust proxyconfigured. Neitherfirebase-functionsnor our code sets it, and nothing readsreq.ip.firebase-admin12 callsnode-forgeonly fromcredential-internal.js(privateKeyFromPemforcert()credentials). We use ADC (admin.initializeApp()with no arguments), so the vulnerable signature-verification path is never hit.Gaps in the plan
firebase-admin14 removes the legacy namespace API (change: Remove Deprecated Legacy Namespace Support firebase/firebase-admin-node#3164, Remove Deprecated Legacy Namespace Support).index.ts,moderation.ts,signalOwnership.ts,removeSignal.tsandsignalRefs.tsmust move to modular imports:admin.firestore(),admin.firestore.FieldValue/Timestamp/GeoPoint/DocumentReference/…,admin.messaging()/admin.messaging.Message, andadmin.auth().getFirestore(),FieldValue/Timestamp/GeoPointfromfirebase-admin/firestore,getMessaging()fromfirebase-admin/messaging, andgetAuth()fromfirebase-admin/auth.initializeAppis still exported from the root.tscflags every site, so nothing fails silently. The modular API already exists on v12, so the migration can land and deploy first, on its own, before any version changes.npm run auditstill fails after the upgrade, because of dev dependencies. The script has no--omit=dev, so these remain:handlebars4.7.9: critical, viats-jest. The in-range fix is 4.7.10, published 2026-10-05.braces3.0.3: high, viajest@29→micromatch. No fixedbracesexists, so this needsjest30 (30.5.2 was published 2026-09-18) along with matchingts-jest/@types/jest.The alternative is to scope the gate to what ships (
npm audit --omit=dev --audit-level=high). That needs a decision either way.Step 1 is subsumed by step 3.
firebase-functions7 depends onexpress@^5.2.1, which resolvesproxy-addr@2.0.8andqs@6.16.0by itself. Step 1 is still worth doing on its own if we want a deploy before the majors land.functions: bump nodemailer 10.0.10 → 10.0.13 once it clears the 7-day quarantine (on/after 2026-10-07) #87 is stale. 10.0.13 has been superseded:
Checked, no action needed
signalLink(the onlyonRequest) usesres.redirect(301, url),res.status(200).send()andreq.query, all of which are valid in Express 5.req.querycomes fromqsor the simple parser, thetypeof rawLang === "string"guard and the extraneous-key check still redirect?lang=a&lang=band?lang[x]=y.index.ts:254) comparesmessaging/registration-token-not-registered/messaging/invalid-registration-token, and v14'sFirebaseMessagingErrorstill buildscodeasmessaging/${code}.firebase-admin, so the namespace migration won't silently pass a mocked suite. Build and runtime smoke tests are what catch it.Suggested order
firebase-admin12, then build, run the tests, and do a full deploy.firebase-admin@14+firebase-functions@7with--before, plusnodemailer(functions: bump nodemailer 10.0.10 → 10.0.13 once it clears the 7-day quarantine (on/after 2026-10-07) #87).handlebars4.7.10 + jest 30), or the--omit=devgate change.dev, followed by the device smoke list above.Split the functions audit gate so dev-only highs stop blocking deploys
Take proxy-addr 2.0.8 for its critical IP-spoofing advisory
Move the functions and admin scripts to the modular Admin SDK API
Upgrade firebase-admin to 14 and firebase-functions to 7
Note that functions now need a Node 22+ firebase CLI to deploy