Review Cloud SQL SQL Server error-information exposure

Reduce unnecessary error details returned to ordinary users.

Description

SQL Server trace flag 3625 hides parameter values in some error messages returned to users outside the sysadmin role.

Potential impact

Detailed errors can reveal internal values. Masking them can also hide clues that support staff need to diagnose a failure.

Remediation

  • Schedule a maintenance window, then set the Cloud SQL flag 3625 to on. After the restart, check what an ordinary user sees and whether support staff can diagnose the error.
  • Keep application error responses generic. Limit who can read detailed logs and how long you keep them.

Examples

Use a supported SQL Server version and supply var.sql_server_tier and the other required instance settings. You can change this flag on the same engine version.

Before

hcl
resource "google_sql_database_instance" "db" {
  name             = "sqlserver-instance"
  database_version = "SQLSERVER_2017_STANDARD"
  region           = "us-central1"

  settings {
    database_flags {
      name  = "3625"
      value = "off"
    }
  }
}

After

hcl
resource "google_sql_database_instance" "db" {
  name             = "sqlserver-instance"
  database_version = "SQLSERVER_2019_STANDARD"
  region           = "us-central1"

  settings {
    tier = var.sql_server_tier

    database_flags {
      name  = "3625"
      value = "on"
    }
  }
}

Changing off to on masks eligible error parameters. Other error text and log entries can still contain sensitive data.

References