Back to controls

Ensure Cloud SQL Database Instances do not implicitly whitelist all public IP addresses

Database Server should accept connections only from trusted network(s)/IP(s) and restrict access from public IP addresses.

Category

Controls

Medium

Applies to

Google Cloud

Coverage

1 queries

Asset types

1 covered

Overview

Database Server should accept connections only from trusted network(s)/IP(s) and restrict access from public IP addresses.

Rationale

To minimize attack surface on a Database server instance, only trusted/known and required IP(s) should be white-listed to connect to it.

An authorized network should not have IPs/networks configured to 0.0.0.0/0 which will allow access to the instance from anywhere in the world. Note that authorized networks apply only to instances with public IPs.

Impact

The Cloud SQL database instance would not be available to public IP addresses.

Remediation guidance

Google Cloud Remediation

Service-wide fix (recommended): remove direct public database access wherever possible and enforce constraints/sql.restrictAuthorizedNetworks so teams cannot reintroduce broad authorized networks later.

Google Cloud console

  1. Open Cloud SQL Instances.
  2. Select the instance.
  3. Go to Connections -> Networking.
  4. Remove any authorized network entry set to 0.0.0.0/0.
  5. Save the change.

Google Cloud CLI

Replace the authorized networks list with only approved ranges:

gcloud sql instances patch <instance-name> --authorized-networks=<cidr-1>,<cidr-2>

Validate the configured authorized networks:

gcloud sql instances describe <instance-name>

Prevention

Enforce the predefined organization policy that restricts authorized networks on Cloud SQL:

name: organizations/<org-id>/policies/sql.restrictAuthorizedNetworks
spec:
  rules:
  - enforce: true
gcloud org-policies set-policy policy.yaml

Operational notes

  • Authorized networks apply only to instances that expose a public IP path. If you can move to private IP or proxied connections, that is usually a better fix.
  • The sql.restrictAuthorizedNetworks constraint is not retroactive. Existing broad entries keep working until you remove them.
  • gcloud sql connect temporarily updates authorized networks and can conflict with these policies. Google recommends gcloud beta sql connect when connection organization policies are enforced.

References

  • https://cloud.google.com/sql/docs/postgres/authorize-networks
  • https://docs.cloud.google.com/sql/docs/postgres/connection-org-policy
  • https://docs.cloud.google.com/sql/docs/sqlserver/org-policy/configure-org-policy
  • https://docs.cloud.google.com/sdk/gcloud/reference/sql/connect

Query logic

These are the stored checks tied to this control.

Google Cloud Cloud SQL

Connectors

Google Cloud

Covered asset types

CloudSQLInstance

Expected check: eq []

{
  cloudSqlInstances(
    where: {
      cloudProvider: "gcp"
      networkSettings_SOME: {
        authorizedNetworks_SOME: {
        OR: [{ cidrValue: "0.0.0.0/0" }, { cidrValue: "::/0" }]
      }
      }
    }
  ) {
    ...AssetFragment
  }
}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon