Description
With skip_show_database enabled, only accounts with the SHOW DATABASES privilege can run that command. This privilege allows them to see the full list of names.
Potential impact
Database names can reveal internal structure. Restricting the list can break tools or applications that depend on it.
Remediation
To restrict listing for ordinary accounts, identify dependent tools and schedule the required restart. Set the flag to on, then test as an ordinary user and as an administrator. Review SHOW DATABASES and broad global grants, and restrict access to the data separately.
Examples
Both examples use the same MySQL 8.0 instance. Supply a supported engine version, machine type and other required settings for your environment.
Before
resource "google_sql_database_instance" "db" {
name = "mysql-instance"
database_version = "MYSQL_8_0"
region = "us-central1"
settings {
database_flags {
name = "skip_show_database"
value = "off"
}
}
}
After
resource "google_sql_database_instance" "db" {
name = "mysql-instance"
database_version = "MYSQL_8_0"
region = "us-central1"
settings {
tier = "db-f1-micro"
database_flags {
name = "skip_show_database"
value = "on"
}
}
}
Explanation:
- Before: With
off, users can run the command. Their privileges determine which names they see. - After:
onrequires the listing privilege. The addeddb-f1-micromachine type is a separate setting.