Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
73721a1
Merge pull request #2851 from firebase/next
CorieW May 18, 2026
cbf171b
security-audit(delete-user-data): remediate CVEs and purge abandonware
inlined Jun 22, 2026
175daa6
security-audit(firestore-send-email): remediate CVEs and purge abando…
inlined Jun 22, 2026
393e129
security-audit(firestore-counter): remediate CVEs and purge abandonware
inlined Jun 22, 2026
1fc8c8b
security-audit(firestore-shorten-urls-bitly): remediate CVEs and purg…
inlined Jun 22, 2026
54cf693
security-audit(rtdb-limit-child-nodes): remediate CVEs and purge aban…
inlined Jun 22, 2026
d4790c7
security-audit(firestore-translate-text): remediate CVEs and purge ab…
inlined Jun 22, 2026
9bb0c1f
security-audit(storage-resize-images): remediate CVEs and purge aband…
inlined Jun 22, 2026
f53ca23
fix(delete-user-data): require fs inline in clean script
inlined Jun 23, 2026
5a65892
fix(firestore-send-email): require fs inline in clean script
inlined Jun 23, 2026
46ef0e3
fix(firestore-counter): require fs inline in clean script
inlined Jun 23, 2026
5f910cf
fix(firestore-shorten-urls-bitly): require fs inline in clean script
inlined Jun 23, 2026
ac53ecd
fix(rtdb-limit-child-nodes): require fs inline in clean script and up…
inlined Jun 23, 2026
099d733
fix(firestore-translate-text): require fs inline in clean script
inlined Jun 23, 2026
c6fbf3b
fix(storage-resize-images): use shx in clean script and async promise…
inlined Jun 23, 2026
3f632ef
style(firestore-counter): run prettier formatter across unit
inlined Jun 23, 2026
718f988
Merge pull request #2883 from firebase/security-audit/firestore-counter
inlined Jun 23, 2026
304208f
Merge pull request #2887 from firebase/security-audit/storage-resize-…
inlined Jun 23, 2026
4c025d4
Merge pull request #2886 from firebase/security-audit/firestore-trans…
inlined Jun 23, 2026
0629aa8
Merge pull request #2885 from firebase/security-audit/rtdb-limit-chil…
inlined Jun 23, 2026
858f69a
Merge pull request #2884 from firebase/security-audit/firestore-short…
inlined Jun 23, 2026
6e49c43
Merge pull request #2882 from firebase/security-audit/firestore-send-…
inlined Jun 23, 2026
3796807
Merge pull request #2881 from firebase/security-audit/delete-user-data
inlined Jun 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,094 changes: 506 additions & 588 deletions delete-user-data/functions/package-lock.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions delete-user-data/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"prepare": "npm run build",
"build": "npm run clean && npm run compile",
"build:watch": "npm run clean && tsc --watch",
"clean": "rimraf lib",
"clean": "node -e \"require('fs').rmSync('lib', { recursive: true, force: true })\"",
"compile": "tsc",
"local:emulator": "cd ../../_emulator && firebase emulators:start -P demo-test",
"test": "cd ../../_emulator && firebase emulators:exec jest -P demo-test",
Expand All @@ -25,8 +25,6 @@
"firebase-admin": "^12.1.0",
"firebase-functions": "^4.9.0",
"lodash.chunk": "^4.2.0",
"node-fetch": "^2.6.2",
"rimraf": "^2.6.3",
"typescript": "^4.9.4",
"@types/jest": "29.5.0",
"jest": "29.7.0",
Expand Down
1 change: 0 additions & 1 deletion delete-user-data/functions/src/runCustomSearchFunction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fetch from "node-fetch";
import { runBatchPubSubDeletions } from "./runBatchPubSubDeletions";
import * as logs from "./logs";
import config from "./config";
Expand Down
2,032 changes: 484 additions & 1,548 deletions firestore-counter/functions/package-lock.json

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions firestore-counter/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@
"license": "Apache-2.0",
"description": "Auto-scalable counters for your app.",
"dependencies": {
"deep-equal": "^1.0.1",
"firebase-admin": "^12.1.0",
"firebase-functions": "^4.9.0",
"uuid": "^3.3.2",
"rimraf": "^2.6.3",
"typescript": "^4.9.4",
"@types/express-serve-static-core": "4.19.8"
},
"devDependencies": {
"@types/deep-equal": "^1.0.1",
"prettier": "1.19.1",
"ts-node": "^7.0.1",
"wait-for-expect": "^3.0.2",
Expand All @@ -25,7 +21,7 @@
"scripts": {
"prepare": "npm run build",
"build": "npm run clean && npm run compile",
"clean": "rimraf lib",
"clean": "node -e \"require('fs').rmSync('lib', { recursive: true, force: true })\"",
"compile": "tsc",
"format": "prettier --write {,**/}*.{yaml,ts,md}",
"test:local": "jest",
Expand Down
4 changes: 2 additions & 2 deletions firestore-counter/functions/src/aggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { firestore } from "firebase-admin";
import * as uuid from "uuid";
import * as crypto from "crypto";

export class NumericUpdate {
protected data: { [key: string]: any } = {};
Expand Down Expand Up @@ -133,7 +133,7 @@ export class NumericUpdate {
}

export class Aggregator {
constructor(private uuidv4: () => string = uuid.v4) {}
constructor(private uuidv4: () => string = () => crypto.randomUUID()) {}
/**
* Aggregates increments from shards and partials and returns an update object suitable for
* DocumentRef.update() call.
Expand Down
18 changes: 12 additions & 6 deletions firestore-counter/functions/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/

import { firestore } from "firebase-admin";
import deepEqual from "deep-equal";
import { isDeepStrictEqual } from "util";
import * as crypto from "crypto";
import { logger } from "firebase-functions";
import * as events from "./events";
import {
Expand All @@ -27,7 +28,6 @@ import {
} from "./common";
import { Planner } from "./planner";
import { Aggregator, NumericUpdate } from "./aggregator";
import * as uuid from "uuid";
import { FieldValue } from "firebase-admin/firestore";

const SHARDS_LIMIT = 100;
Expand Down Expand Up @@ -111,7 +111,10 @@ export class ShardedCounterWorker {
await this.db.runTransaction(async (t) => {
try {
const snap = await t.get(this.metadoc.ref);
if (snap.exists && deepEqual(snap.data(), this.metadata)) {
if (
snap.exists &&
isDeepStrictEqual(snap.data(), this.metadata)
) {
t.update(snap.ref, {
timestamp: FieldValue.serverTimestamp(),
stats: stats,
Expand Down Expand Up @@ -145,7 +148,7 @@ export class ShardedCounterWorker {

unsubscribeMetadataListener = this.metadoc.ref.onSnapshot((snap) => {
// if something's changed in the worker metadata since we were called, abort.
if (!snap.exists || !deepEqual(snap.data(), this.metadata)) {
if (!snap.exists || !isDeepStrictEqual(snap.data(), this.metadata)) {
logger.log("Shutting down because metadoc changed.");
shutdown().then(resolve).catch(reject);
}
Expand Down Expand Up @@ -239,7 +242,10 @@ export class ShardedCounterWorker {
}

// Check that we still own the slice.
if (!metadoc.exists || !deepEqual(metadoc.data(), this.metadata)) {
if (
!metadoc.exists ||
!isDeepStrictEqual(metadoc.data(), this.metadata)
) {
logger.log("Metadata has changed, bailing out...");
return [];
}
Expand Down Expand Up @@ -351,7 +357,7 @@ export class ShardedCounterWorker {
}
t.set(
snap.ref,
update.toPartialShard(() => uuid.v4())
update.toPartialShard(() => crypto.randomUUID())
);
}
} catch (err) {
Expand Down
Loading
Loading