From f139e5f305377cc93a9b9ed908dbe1329a9b4df8 Mon Sep 17 00:00:00 2001 From: Kyle Montville Date: Fri, 4 Oct 2024 11:10:07 -0700 Subject: [PATCH] Remove Firebase App Check (#849) * update firebase functions module * update roar-firekit and remove lines related to App Check --- package-lock.json | 15 +++++++-------- package.json | 2 +- roar-firebase-functions | 2 +- src/config/firebaseRoar.js | 24 ++++++++++++------------ src/helpers/query/utils.js | 18 +++++++++--------- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 057e6f2f2..9fb6a3250 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "2.11.18", "dependencies": { "@bdelab/roam-fluency": "1.11.26", - "@bdelab/roar-firekit": "^9.0.1", + "@bdelab/roar-firekit": "9.1.0", "@bdelab/roar-letter": "1.11.8", "@bdelab/roar-multichoice": "^1.11.3", "@bdelab/roar-pa": "2.2.4", @@ -1848,10 +1848,9 @@ } }, "node_modules/@bdelab/roar-firekit": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@bdelab/roar-firekit/-/roar-firekit-9.0.1.tgz", - "integrity": "sha512-MscBltVjx0V1BsTP+n5/3Afwtp76DDe67CgeqrnCTClXgqUyq2KWzB9cndppVhr2Fk6XZWPbk5rrnAvjZpN6fw==", - "license": "ISC", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@bdelab/roar-firekit/-/roar-firekit-9.1.0.tgz", + "integrity": "sha512-fw8J2DnVlaVqdIyYU9m18X346vTS+zo8DfVpZ/VYh7+gl2taD2QS7DVM/1DFJHF9/WVMZ7H4fg8xm85E0T8oQQ==", "dependencies": { "@bdelab/roar-firekit": "^4.1.1", "crc-32": "^1.2.2", @@ -38982,9 +38981,9 @@ } }, "@bdelab/roar-firekit": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@bdelab/roar-firekit/-/roar-firekit-9.0.1.tgz", - "integrity": "sha512-MscBltVjx0V1BsTP+n5/3Afwtp76DDe67CgeqrnCTClXgqUyq2KWzB9cndppVhr2Fk6XZWPbk5rrnAvjZpN6fw==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@bdelab/roar-firekit/-/roar-firekit-9.1.0.tgz", + "integrity": "sha512-fw8J2DnVlaVqdIyYU9m18X346vTS+zo8DfVpZ/VYh7+gl2taD2QS7DVM/1DFJHF9/WVMZ7H4fg8xm85E0T8oQQ==", "requires": { "@bdelab/roar-firekit": "^4.1.1", "crc-32": "^1.2.2", diff --git a/package.json b/package.json index 9af767ae2..2b39c9a9d 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "dependencies": { "@bdelab/roam-fluency": "1.11.26", - "@bdelab/roar-firekit": "^9.0.1", + "@bdelab/roar-firekit": "9.1.0", "@bdelab/roar-letter": "1.11.8", "@bdelab/roar-multichoice": "^1.11.3", "@bdelab/roar-pa": "2.2.4", diff --git a/roar-firebase-functions b/roar-firebase-functions index 27875477c..737a604aa 160000 --- a/roar-firebase-functions +++ b/roar-firebase-functions @@ -1 +1 @@ -Subproject commit 27875477c98d9b65712b2413b3780ed15bf97e6c +Subproject commit 737a604aadcb35d6e4588124b33279dff1d5abe8 diff --git a/src/config/firebaseRoar.js b/src/config/firebaseRoar.js index 4773334b6..5c617ba8c 100644 --- a/src/config/firebaseRoar.js +++ b/src/config/firebaseRoar.js @@ -8,16 +8,16 @@ const isEmulated = import.meta.env.VITE_FIREBASE_EMULATOR === 'true'; const useSandbox = import.meta.env.VITE_FIREBASE_DATA_SOURCE === 'sandbox'; const isStaging = import.meta.env.VITE_STAGING_BUILD === 'true'; -function setDebugToken(config) { - // For Cypress tests, use the debug token from the Cypress config. If running on localhost, use the VITE_APPCHECK_DEBUG_TOKEN - // environment variable (set as a local environment variable in the .env file). If neither are set, create a new debug token which will be inactive until it is set in the - // Firebase App Check console - config.debugToken = window.Cypress - ? Cypress.env('appCheckDebugToken') - : window.location.hostname === 'localhost' - ? import.meta.env.VITE_APPCHECK_DEBUG_TOKEN || (self.FIREBASE_APPCHECK_DEBUG_TOKEN = true) - : undefined; -} +// function setDebugToken(config) { +// // For Cypress tests, use the debug token from the Cypress config. If running on localhost, use the VITE_APPCHECK_DEBUG_TOKEN +// // environment variable (set as a local environment variable in the .env file). If neither are set, create a new debug token which will be inactive until it is set in the +// // Firebase App Check console +// config.debugToken = window.Cypress +// ? Cypress.env('appCheckDebugToken') +// : window.location.hostname === 'localhost' +// ? import.meta.env.VITE_APPCHECK_DEBUG_TOKEN || (self.FIREBASE_APPCHECK_DEBUG_TOKEN = true) +// : undefined; +// } if (isEmulated) { appConfig = { @@ -80,8 +80,8 @@ if (isEmulated) { }; } -setDebugToken(appConfig); -setDebugToken(adminConfig); +// setDebugToken(appConfig); +// setDebugToken(adminConfig); export default { app: appConfig, diff --git a/src/helpers/query/utils.js b/src/helpers/query/utils.js index 8c6b6a9ca..4da5b51a9 100644 --- a/src/helpers/query/utils.js +++ b/src/helpers/query/utils.js @@ -75,15 +75,15 @@ export const getAxiosInstance = (db = 'admin', unauthenticated = false) => { const { roarfirekit } = storeToRefs(authStore); const axiosOptions = _get(roarfirekit.value.restConfig, db) ?? {}; - // Add appCheckToken to the headers if it exists in the firekit config - const appCheckToken = roarfirekit.value[db]?.appCheckToken; - - if (appCheckToken) { - axiosOptions.headers = { - ...axiosOptions.headers, - 'X-Firebase-AppCheck': appCheckToken, - }; - } + // // Add appCheckToken to the headers if it exists in the firekit config + // const appCheckToken = roarfirekit.value[db]?.appCheckToken; + // + // if (appCheckToken) { + // axiosOptions.headers = { + // ...axiosOptions.headers, + // 'X-Firebase-AppCheck': appCheckToken, + // }; + // } if (unauthenticated) { delete axiosOptions.headers;