cypress-firebase
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
@@ -1,2 +0,1 @@ | ||
import { getServiceAccount } from './node-utils'; | ||
import { convertValueToTimestampOrGeoPointIfPossible } from './tasks'; | ||
@@ -32,3 +31,22 @@ /** | ||
} | ||
/* eslint-enable camelcase */ | ||
/** | ||
* Get service account from either SERVICE_ACCOUNT environment variable | ||
* @returns Service account object | ||
*/ | ||
function getServiceAccount() { | ||
// Environment variable | ||
const serviceAccountEnvVar = process.env.SERVICE_ACCOUNT; | ||
if (serviceAccountEnvVar) { | ||
try { | ||
return JSON.parse(serviceAccountEnvVar); | ||
} | ||
catch (err) { | ||
/* eslint-disable no-console */ | ||
console.warn(`cypress-firebase: Issue parsing "SERVICE_ACCOUNT" environment variable from string to object, returning string`); | ||
/* eslint-enable no-console */ | ||
} | ||
} | ||
} | ||
/** | ||
* @param adminInstance - firebase-admin instance to initialize | ||
@@ -35,0 +53,0 @@ * @returns Firebase admin credential |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.deleteCollection = exports.slashPathToFirestoreRef = exports.applyWhere = exports.isDocPath = exports.initializeFirebase = exports.isString = void 0; | ||
const node_utils_1 = require("./node-utils"); | ||
const tasks_1 = require("./tasks"); | ||
@@ -36,3 +35,22 @@ /** | ||
} | ||
/* eslint-enable camelcase */ | ||
/** | ||
* Get service account from either SERVICE_ACCOUNT environment variable | ||
* @returns Service account object | ||
*/ | ||
function getServiceAccount() { | ||
// Environment variable | ||
const serviceAccountEnvVar = process.env.SERVICE_ACCOUNT; | ||
if (serviceAccountEnvVar) { | ||
try { | ||
return JSON.parse(serviceAccountEnvVar); | ||
} | ||
catch (err) { | ||
/* eslint-disable no-console */ | ||
console.warn(`cypress-firebase: Issue parsing "SERVICE_ACCOUNT" environment variable from string to object, returning string`); | ||
/* eslint-enable no-console */ | ||
} | ||
} | ||
} | ||
/** | ||
* @param adminInstance - firebase-admin instance to initialize | ||
@@ -42,3 +60,3 @@ * @returns Firebase admin credential | ||
function getFirebaseCredential(adminInstance) { | ||
const serviceAccount = (0, node_utils_1.getServiceAccount)(); | ||
const serviceAccount = getServiceAccount(); | ||
// Add service account credential if it exists so that custom auth tokens can be generated | ||
@@ -45,0 +63,0 @@ if (serviceAccount) { |
{ | ||
"name": "cypress-firebase", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"description": "Utilities to help testing Firebase projects with Cypress.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
16
126724
27
2218