For the complete documentation index, see llms.txt. This page is also available as Markdown.
Cortex CloudApplication Security

GCP SQL database is publicly accessible misconfiguration detected in code

Rule Details

Cortex AppSec Rule ID

APPSEC_GCP_11

Category - Subcategory

Public Exposure - Database Endpoints

Provider

GCP

Severity

HIGH

Framework

Terraform, Terraform Plan

Impact

Cloud SQL is a fully managed relational database service for MySQL, PostgreSQL, and SQL Server. It offers data encryption at rest and in transit, Private connectivity with VPC and user-controlled network access with firewall protection. It is possible to configure Cloud SQL to have a public IPv4 address. This means your cluster can accept connections from specific IP addresses, or a range of addresses, by adding authorized addresses to your instance. We do not recommend this option. We recommend you ensure Cloud SQL Database Instances are not publicly accessible, to help secure against attackers scanning the internet in search of public databases.

How to Fix

Resource: google_compute_network

  • Arguments: private_network (Optional) The VPC network from which the Cloud SQL instance is accessible for private IP.

For example, projects/myProject/global/networks/default. Specifying a network enables private IP. Either ipv4_enabled must be enabled or a private_network must be configured. This setting can be updated, but it cannot be removed after it is set. [source,go]

resource "google_compute_network" "private_network" { provider = google-beta

name = "private-network" }

resource "google_compute_global_address" "private_ip_address" { provider = google-beta

name = "private-ip-address" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 16 network = google_compute_network.private_network.id }

Last updated

Was this helpful?