More Info:

Cloud Functions should access resources only in VPC

Risk Level

Medium

Address

Security

Compliance Standards

PCIDSS, SOC2, NISTCSF

Triage and Remediation

Remediation

To remediate the misconfiguration “Cloud Functions Should Connect To Resources In VPC only” for GCP using GCP console, follow the below steps:

  1. Open the Google Cloud Console and select the project where the Cloud Function is located.
  2. In the left-hand navigation menu, select “VPC Network” and then select “VPC networks”.
  3. Select the VPC network that you want to use for your Cloud Function.
  4. In the “VPC Network Details” page, select “Add subnet”.
  5. In the “Create subnet” page, enter a name for the subnet and select the region where you want the subnet to be located.
  6. Configure the subnet IP range and select the VPC network that you want to use for your Cloud Function.
  7. Click “Create” to create the subnet.
  8. In the left-hand navigation menu, select “Cloud Functions” and then select the Cloud Function that you want to configure.
  9. In the “Cloud Function Details” page, click on the “Edit” button.
  10. Scroll down to the “VPC connector” section and select the VPC connector that you created in step 6.
  11. Click “Save” to save the changes.

After following these steps, your Cloud Function will be configured to connect to resources in the specified VPC only.

Additional Reading: