From 791310ff4b0a828ca6d1f5c0fa03a110972afb1f Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Thu, 27 May 2021 12:18:44 -0600 Subject: [PATCH] fix: do not leak credentials in Firestore.toJSON() (#1522) --- dev/src/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dev/src/index.ts b/dev/src/index.ts index 60cd32358..e143554e7 100644 --- a/dev/src/index.ts +++ b/dev/src/index.ts @@ -1312,6 +1312,16 @@ export class Firestore implements firestore.Firestore { return this._clientPool.terminate(); } + /** + * Returns the Project ID to serve as the JSON representation of this + * Firestore instance. + * + * @return An object that contains the project ID (or `undefined` if not yet + * available). + */ + toJSON(): object { + return {projectId: this._projectId}; + } /** * Initializes the client if it is not already initialized. All methods in the * SDK can be used after this method completes.