π Google Cloud Function Environment Variables store confidential data π’
- Contextual name: π Cloud Function Environment Variables store confidential data π’
- ID:
/ce/ca/google/cloud-run/function-environment-variables-store-confidential-data
- Located in: π Google Cloud Run
Flagsβ
- π’ Impossible policy
- π’ Policy with categories
- π’ Policy with type
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
SECURITY
Similar Policiesβ
- Cloud Conformity
Descriptionβ
Descriptionβ
Google Cloud Functions allow you to host serverless code that is executed when an event is triggered, without the requiring the management a host operating system. These functions can also store environment variables to be used by the code that may contain authentication or other information that needs to remain confidential.
Rationaleβ
It is recommended to use the Secret Manager, because environment variables are stored unencrypted, and accessible for all users who have access to the code.
Impactβ
There should be no impact on the Cloud Function. There are minor costs after 10,000 requests a month to the Secret Manager API as well for a high use of other functions. Modifying the Cloud Function to use the Secret Manager may prevent it running to completion.
Auditβ
Determine if Confidential Information is Stored in your Functions in Cleartextβ
From Google Cloud Consoleβ
- Within the project you wish to audit, select the Navigation hamburger menu in the top left. Scroll down to under the heading
Serverless
, then selectCloud Functions
... see more
Remediationβ
Remediationβ
Enable Secret Manager API for your Projectβ
From Google Cloud Consoleβ
- Within the project you wish to enable, select the Navigation hamburger menu in the top left. Hover over
APIs & Services
to under the headingServerless
, then selectEnabled APIs & Services
in the menu that opens up.- Click the button
+ Enable APIS and Services
- In the
Search
bar, search forSecret Manager API
and select it.- Click the blue box that says
Enable
.From Google Cloud CLIβ
Within the project you wish to enable the API in, run the following command.
gcloud services enable Secret Manager API
Reviewing Environment Variables That Should Be Migrated to Secret Managerβ
From Google Cloud Consoleβ
- Log in to the Google Cloud Web Portal
- Go to
Cloud Functions
- Click on a function name from the list
- Click on
Edit
and review theRuntime environment
for variables that should be secrets. Leave this list open for the next step.From Google Cloud CLIβ
... see more
policy.yamlβ
Linked Framework Sectionsβ
Section | Sub Sections | Internal Rules | Policies | Flags |
---|---|---|---|---|
πΌ CIS GCP v3.0.0 β πΌ 1.17 Ensure Secrets are Not Stored in Cloud Functions Environment Variables by Using Secret Manager - Level 1 (Manual) | 1 | |||
πΌ Cloudaware Framework β πΌ Secure Access | 43 |