I've just made a migration from 1st gen Firebase functions to 2nd gen. In this documentation, there written: GCP does not guarantee the pure safety of the data stored in a form of env variable. The article also recommends use of Secret Manager which is much more expensive than the read op of Firestore. It also means that Google does not guarantee the safety of the env variables in the Firebase functions' runtime. I use Node.js 16 runtime within 2nd gen of Firebase functions.
Is 2nd gen Firebase functions' Node.js 16 runtime environment safe enough to use sensitive data within runtime? I'm planning to read the most sensitive data from Firestore within the 2nd gen Firebase functions' Node.js 16 runtime and use it without logging it in my code. But, if such secure data like env variables can be logged in some kind of runtimes(which are not specified in the above documentation), it would be frustrating for me to find out and handle such security exceptions. So i want to make sure that the data retrieved from Firestore in the 2nd generation Firebase Functions' Node.js 16 runtime is completely safe. Unfortunately, i couldn't have found any proper documentation specifying such safety guarantee of Node.js 16 runtime.
+as @Doug mentioned in the comment, completely safe
is too ambiguous in the context.
So here's the details for the safety in the question:
Environment variables can be used for function configuration, but are not recommended as a way to store secrets such as database credentials or API keys. These more sensitive values should be stored outside both your source code and outside environment variables. Some execution environments or the use of some frameworks can result in the contents of environment variables being sent to logs, and storing sensitive credentials in YAML files, deployment scripts or under source control is not recommended. For storing secrets, we recommend that you review the best practices for secret management. Note that there is no Cloud Functions-specific integration with Cloud KMS.
Safety in the context is as following: Considering the comments above from the official docs, i want to make sure that my retrieved data from Firestore or elsewhere, string constants in my index.js and runtime environment variables, not to be logged or recorded at all. Most of all, not to be exposed to client side who triggers the function;.
If the runtime is safe and free from any kind of exposure of Firestore data retrieved to client side, necessity of Secret Manager and higher price will just disappear.