Cloud Functions are not encrypted with customer-managed encryption keys Affecting Cloud Functions service in Google


0.0
medium
0
10
    Severity Framework Snyk CCSS
    Rule category Keys and Secrets / Encryption at Rest

Is your enviroment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
    Frameworks
  • Snyk ID SNYK-CC-00807
  • credit Snyk Research Team

Description

Enforcing the use of customer-managed encryption keys (CMEK) for Cloud Functions ensures that data is encrypted according to the organization's specific security and compliance requirements. Without CMEK, the default Google-managed keys are used, which may not comply with certain regulatory frameworks or internal policies. CMEKs provides greater control over the encryption keys, including the ability to manage key rotation and disable keys, reducing the risk of unauthorized data access.

How to fix?

Set the kms_key_name attribute in google_cloudfunctions_function resource to a valid customer-managed encryption key.

resource "google_cloudfunctions_function" "allow" {
  name        = "function-snyk807"
  description = "My function snyk807"
  runtime     = "nodejs20"

  available_memory_mb   = 128
  source_archive_bucket = google_storage_bucket.bucket.name
  source_archive_object = google_storage_bucket_object.object.name
  trigger_http          = true
  entry_point           = "helloWorld"
  docker_registry = "ARTIFACT_REGISTRY"
  docker_repository = google_artifact_registry_repository.allowed-snyk-807.id
  kms_key_name = google_kms_crypto_key.snyk_807_key.id
}