Skip to content

Conversation

@cx-andre-pereira
Copy link
Contributor

@cx-andre-pereira cx-andre-pereira commented Oct 19, 2025

Reason for Proposed Changes

  • Currently there is no query to ensure that a "google_sql_database_instance" resource with a "MYSQL" based "database_version" has the 'skip_show_database' flag enabled.

  • Quoting CIS_Google_Cloud_Platform_Foundation_Benchmark_v4.0.0 page 210: "skip_show_database database flag prevents people from using the SHOW DATABASES statement if they do not have the SHOW DATABASES privilege. This can improve security if you have concerns about users being able to see databases belonging to other users."

Proposed Changes

  • Implemented the missing query.
  • The query will flag for 4 separate instances : (all after ensuring "database_version" is MYSQL based)
    • Missing the "settings" field
    • Missing the "settings.database_flags" field
    • Missing a definition for the "skip_show_database" flag on the "database_flags" field
    • Setting the "skip_show_database" flag to a value that is not "on"

"Datadog" reference

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions bot added feature New feature query New query feature labels Oct 19, 2025
@github-actions
Copy link
Contributor

kics-logo

KICS version: v2.1.13

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 1
Files parsed placeholder 1
Files failed to scan placeholder 0
Total executed queries placeholder 47
Queries failed to execute placeholder 0
Execution time placeholder 0

@github-actions github-actions bot added terraform Terraform query gcp PR related with GCP Cloud labels Oct 19, 2025
@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review October 19, 2025 18:26
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner October 19, 2025 18:26
Copy link
Contributor

@cx-artur-ribeiro cx-artur-ribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice addition André.

Copy link
Contributor

@cx-artur-ribeiro cx-artur-ribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice case addition, I hadn't found this link before:
https://discuss.google.dev/t/terraform-variables-for-setting-mysql-database-flags/102268/2

Apparently we can support this format as well.

…t_the_'skip_show_database'_database_flag_for_cloud_sql_mysql_intance_is_set_to_off
…16622_9_6.1-MySQL_Database_ensure_that_the_'skip_show_database'_database_flag_for_cloud_sql_mysql_intance_is_set_to_off
…t_the_'skip_show_database'_database_flag_for_cloud_sql_mysql_intance_is_set_to_off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature gcp PR related with GCP Cloud query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants