Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(terraform): false positive for SQLDatabaseSSLDisabled in google terraform provider >=6.0.1 #7263

Open
henrythor opened this issue Sep 24, 2024 · 0 comments
Labels
bug Something isn't working community Community contribution docker Docker query gcp PR related with GCP Cloud query New query feature terraform Terraform query

Comments

@henrythor
Copy link

henrythor commented Sep 24, 2024

Expected Behavior

A google_sql_database_instance with settings.ip_configuration[].ssl_mode set to "TRUSTED_CLIENT_CERTIFICATE_REQUIRED" or "ENCRYPTED_ONLY" should be a negative. settings.ip_configuration[].require_ssl is deprecated and removed from provider as of version 6.0.1.

Actual Behavior

kics is looking for deprecated attribute settings.ip_configuration[].require_ssl and returning a false positive in its absence

Steps to Reproduce the Problem

Use the following file

resource "google_sql_database_instance" "psql" {
  name             = "test-psql-database"
  region           = "europe-west1"
  database_version = "POSTGRES_15"
  project          = "my-project"

  settings {
    activation_policy = "ALWAYS"
    availability_type = "REGIONAL"
    disk_autoresize   = true

    ip_configuration {
      ipv4_enabled                                  = false
      private_network                               = var.vpc_id
      enable_private_path_for_google_cloud_services = true
      ssl_mode                                      = "TRUSTED_CLIENT_CERTIFICATE_REQUIRED"
    }
    backup_configuration {
      binary_log_enabled             = var.binary_log_enabled
      enabled                        = var.backup_enabled
      location                       = var.region
      point_in_time_recovery_enabled = var.point_in_time_recovery_enabled
      start_time                     = var.backup_start_time
      transaction_log_retention_days = var.transaction_log_retention_days

      backup_retention_settings {
        retained_backups = var.retained_backups
      }
    }
  }
}

Run the following command:

docker run -t -v $PWD:/path checkmarx/kics:latest scan -p /path -o "/path/"

Get the following output:

...
Scanning with Keeping Infrastructure as Code Secure v2.1.2


Preparing Scan Assets: Done                                                                                             
Executing queries: [---------------------------------------------------] 100.00%



SQL DB Instance With SSL Disabled, Severity: HIGH, Results: 1
Description: Cloud SQL Database Instance should have SSL enabled
Platform: Terraform
Learn more about this vulnerability: https://docs.kics.io/latest/queries/terraform-queries/gcp/02474449-71aa-40a1-87ae-e14497747b00

	[1]: ../../path/cloud_sql.tf:13

		012: 
		013:     ip_configuration {
		014:       ipv4_enabled                                  = false



Results Summary:
CRITICAL: 0
HIGH: 1
MEDIUM: 0
LOW: 0
INFO: 0
TOTAL: 1

Generating Reports: Done       

Specifications

N/A

@henrythor henrythor added bug Something isn't working community Community contribution labels Sep 24, 2024
@github-actions github-actions bot added query New query feature docker Docker query terraform Terraform query gcp PR related with GCP Cloud labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community Community contribution docker Docker query gcp PR related with GCP Cloud query New query feature terraform Terraform query
Projects
None yet
Development

No branches or pull requests

1 participant