Skip to content

feat(query): implements Postgres_RDS_Logging_Disabled--terraform/aws#7615

Merged
cx-artur-ribeiro merged 13 commits into
masterfrom
AST-40749-FN_Postgres_RDS_Logging_Disabled--terraform/aws
Aug 19, 2025
Merged

feat(query): implements Postgres_RDS_Logging_Disabled--terraform/aws#7615
cx-artur-ribeiro merged 13 commits into
masterfrom
AST-40749-FN_Postgres_RDS_Logging_Disabled--terraform/aws

Conversation

@cx-andre-pereira

@cx-andre-pereira cx-andre-pereira commented Jul 31, 2025

Copy link
Copy Markdown
Contributor

Reason for Proposed Changes

  • There is currently no query to detect whether the capturing of logs generated by Amazon RDS for PostgreSQL is properly configured.
  • Without these configurations, critical visibility into query behavior and system health may be lost.

Proposed Changes

  • Added the query "Postgres_RDS_Logging_Disabled".
  • Added a condition to validate that the log_statement parameter is set to "all" in aws_db_parameter_group, ensuring every SQL statement is logged.
  • Added a condition to check that the log_min_duration_statement parameter is set to "1"(1ms), enabling the logging of even the shortest-running queries. This helps with granular performance profiling while still ignoring near-zero-duration or trivial queries that are unlikely to provide meaningful insights.
  • Case scenarios include: (same order as CxPolicy's definitions)
    • Complete lack of the parameter field / log_statement+log_min_duration_statement fields.
    • Either log_statement or log_min_duration_statement being set to the wrong value.
    • Both log_statement and log_min_duration_statement being set to the wrong value.

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions Bot added feature New feature query New query feature terraform Terraform query aws PR related with AWS Cloud labels Jul 31, 2025
@github-actions

Copy link
Copy Markdown
Contributor

kics-logo

KICS version: v2.1.11

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 marked this pull request as ready for review July 31, 2025 09:00
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner July 31, 2025 09:00

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey André,
Let me know what you think of my suggestions please.

Comment thread assets/queries/terraform/aws/postgres_rds_logging_disabled/metadata.json Outdated
Comment thread assets/queries/terraform/aws/postgres_rds_logging_disabled/query.rego Outdated
Comment thread assets/queries/terraform/aws/postgres_rds_logging_disabled/query.rego Outdated
Comment thread assets/queries/terraform/aws/postgres_rds_logging_disabled/query.rego Outdated
@gitguardian

gitguardian Bot commented Aug 11, 2025

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
4266022 Triggered Generic Password e0698da assets/queries/cloudFormation/aws/amplify_branch_basic_auth_config_password_exposed/test/negative7.yaml View secret
9419039 Triggered Username Password e0698da assets/queries/cloudFormation/aws/amplify_branch_basic_auth_config_password_exposed/test/positive6.json View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Comment thread assets/queries/terraform/aws/postgres_rds_logging_disabled/query.rego Outdated
Comment thread assets/queries/terraform/aws/postgres_rds_logging_disabled/query.rego Outdated
Comment thread assets/queries/terraform/aws/postgres_rds_logging_disabled/query.rego Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work André, great auxiliar functions!

@cx-artur-ribeiro cx-artur-ribeiro merged commit c521767 into master Aug 19, 2025
27 checks passed
@cx-artur-ribeiro cx-artur-ribeiro deleted the AST-40749-FN_Postgres_RDS_Logging_Disabled--terraform/aws branch August 19, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aws PR related with AWS Cloud 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