PostgreSQL 'log_min_messages' database flag is not set appropriately Affecting Cloud SQL service in Google


Severity

0.0
medium
0
10
    Severity Framework
    Snyk CCSS
    Rule category
    General / Configuration

Is your enviroment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
    Frameworks
    CIS-Controls CSA-CCM GDPR ISO-27001 NIST-800-53 PCI-DSS SOC-2
  • Snyk ID SNYK-CC-00223
  • credit Snyk Research Team

Description

The PostgreSQL database instance flag 'log_min_messages' controls which message levels are written to the server log. Valid values include INFO, WARNING (default), and ERROR. If this flag is not set to the correct value, important messages useful for troubleshooting may not be logged.

How to fix?

Set the settings.database_flags.name attribute to "log_min_messages and settings.database_flags.value attribute to "info", "warning", or "error".

Example Configuration

resource "google_sql_database_instance" "default" {
  name                = "all-valid-flags-pg-instance"
  database_version    = "POSTGRES_11"
  region              = "us-east1"
  deletion_protection = false

  settings {
    tier = "db-f1-micro"

    database_flags {
      name  = "log_min_messages"
      value = "error"
    }
  }
}