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_disconnections' flag enabled.

  • Quoting CIS_Google_Cloud_Platform_Foundation_Benchmark_v4.0.0 page 223: "PostgreSQL does not log session details such as duration and session end by default. Enabling the log_disconnections setting will create log entries at the end of each session which can be useful in troubleshooting issues and determine any unusual activity across a time period."

Proposed Changes

  • Implemented the missing query.

  • The query will flag for 4 separate instances : (all after ensuring "database_version" is POSTGRES based (possible values list))

    • Missing the "settings" field
    • Missing the "settings.database_flags" field
    • Missing a definition for the "log_disconnections" flag on the "database_flags" field
    • Setting the "log_disconnections" flag to a value that is not "on" (default value is off)

Tenable reference

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions bot added query New query feature terraform Terraform query labels Oct 21, 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

@cx-andre-pereira cx-andre-pereira changed the title initial implementation feat(query): implements "Beta - SQL DB Instance Without Disconnections Logging" Oct 21, 2025
@github-actions github-actions bot added the feature New feature label Oct 21, 2025
@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review October 21, 2025 11:26
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner October 21, 2025 11: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

…re_that_the_'log_disconnections'_database_flag_for_cloud_sql_postgresql_instance_is_set_to_on
…16625_12_6.2_PostgreSQL_Database_ensure_that_the_'log_disconnections'_database_flag_for_cloud_sql_postgresql_instance_is_set_to_on
…re_that_the_'log_disconnections'_database_flag_for_cloud_sql_postgresql_instance_is_set_to_on
@cx-andre-pereira cx-andre-pereira merged commit d436368 into master Nov 5, 2025
28 of 29 checks passed
@cx-andre-pereira cx-andre-pereira deleted the AST-116625_12_6.2_PostgreSQL_Database_ensure_that_the_'log_disconnections'_database_flag_for_cloud_sql_postgresql_instance_is_set_to_on branch November 5, 2025 16:52
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