Skip to content

fix(terraform): CKV_GCP_13 pass when client_certificate_config is omitted#7569

Open
arpitjain099 wants to merge 2 commits into
bridgecrewio:mainfrom
arpitjain099:fix/ckv-gcp-13-omitted-client-cert-fp
Open

fix(terraform): CKV_GCP_13 pass when client_certificate_config is omitted#7569
arpitjain099 wants to merge 2 commits into
bridgecrewio:mainfrom
arpitjain099:fix/ckv-gcp-13-omitted-client-cert-fp

Conversation

@arpitjain099

Copy link
Copy Markdown

Fixes #7558

Problem

CKV_GCP_13 ("Ensure client certificate authentication to Kubernetes Engine Clusters is disabled") fails on any google_container_cluster that does not explicitly set:

master_auth {
  client_certificate_config {
    issue_client_certificate = false
  }
}

That is a false positive. The google provider defaults issue_client_certificate to false, so a cluster that omits the block entirely already has client certificate authentication disabled. The check was penalizing the safer pattern (rely on the secure default) and rewarding boilerplate (declare an empty block just to satisfy the scanner).

Provider default evidence

Root cause

GKEClientCertificateDisabled extends BaseResourceValueCheck without setting missing_block_result, which defaults to CheckResult.FAILED. When the inspected key is absent, scan_resource_conf returns missing_block_result, so an omitted-but-secure block is reported as a failure.

Fix

Pass missing_block_result=CheckResult.PASSED. An omitted block now passes (matching the provider default), while an explicit issue_client_certificate = true still fails.

Repro / before and after

resource "google_container_cluster" "implicit" {
  name     = "implicit"
  location = "us-central1"
}

Before: FAILED for resource: google_container_cluster.implicit
After: PASSED for resource: google_container_cluster.implicit

An explicit issue_client_certificate = true remains FAILED (existing test_failure is unchanged).

Tests

Added test_success_omitted_block asserting an omitted block passes. Verified the new test fails against the unpatched check and passes with the fix; the existing pass/fail cases are unchanged.

tests/terraform/checks/resource/gcp/test_GKEClientCertificateDisabled.py ... 3 passed

…tted

CKV_GCP_13 failed any google_container_cluster that did not explicitly
set master_auth.client_certificate_config.issue_client_certificate = false.
The google provider defaults that field to false, so omitting the block
already leaves client certificate authentication disabled. Treating the
omission as a failure is a false positive that punishes the secure default.

Pass missing_block_result=CheckResult.PASSED so an omitted block passes,
while an explicit issue_client_certificate = true still fails.

Fixes bridgecrewio#7558

Signed-off-by: arpitjain099 <arpitjain099@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CKV_GCP_13 false positive: fails when client_certificate_config is omitted, even though provider default is the desired value

1 participant