Skip to content

Conversation

@cx-andre-pereira
Copy link
Contributor

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

Reason for Proposed Changes

  • Currently there is no query to ensure that a "google_sql_database_instance" resource with a "POSTGRES" based "database_version" has the 'log_min_messages' flag set to the severity threshold of "WARNING" or higher.

  • Quoting CIS_Google_Cloud_Platform_Foundation_Benchmark_v4.0.0 page 229: "Auditing helps in troubleshooting operational problems and also permits forensic analysis. If log_min_messages is not set to the correct value, messages may not be classified as error messages appropriately. Setting the threshold to 'Warning' will log messages for the most needed error messages."

Proposed Changes

  • Implemented the missing query.
  • The query will flag for a specific instance : (all after ensuring "database_version" is POSTGRES based (possible values list))
    • Setting the "log_min_messages" flag to a value that is not warning or higher: "WARNING"|"ERROR"|"LOG"|"FATAL"|"PANIC" (default value is ERROR)

Tenable reference

I submit this contribution under the Apache-2.0 license.

@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 feature New feature query New query feature terraform Terraform query labels Oct 21, 2025
@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review October 21, 2025 11:37
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner October 21, 2025 11:37
@cx-andre-pereira cx-andre-pereira changed the title feat(query): implements "Beta - SQL DB Instance With Unrecommended Logging Treshold" feat(query): implements "Beta - SQL DB Instance With Unrecommended Logging Threshold" Oct 22, 2025
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.

Only a quality of life change, if you agree with my suggestion. Rather than that, looks good to me.

…re_that_the_'log_min_messages'_database_flag_for_cloud_sql_postgresql_instance_is_set_at_minimum_to_warning
…16626_13_6.2_PostgreSQL_Database_ensure_that_the_'log_min_messages'_database_flag_for_cloud_sql_postgresql_instance_is_set_at_minimum_to_warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants