terraform.gcp.security.gcp-pubsub-encrypted-with-cmk.gcp-pubsub-encrypted-with-cmk
semgrep
Author
unknown
Download Count*
License
Ensure PubSub Topics are encrypted with Customer Supplied Encryption Keys (CSEK)
Run Locally
Run in CI
Defintion
rules:
- id: gcp-pubsub-encrypted-with-cmk
patterns:
- pattern: |
resource "google_pubsub_topic" $ANYTHING {
...
}
- pattern-not-inside: |
resource "google_pubsub_topic" $ANYTHING {
...
kms_key_name = ...
...
}
message: Ensure PubSub Topics are encrypted with Customer Supplied Encryption
Keys (CSEK)
metadata:
category: security
technology:
- terraform
- gcp
owasp:
- A03:2017 - Sensitive Data Exposure
cwe:
- "CWE-320: CWE CATEGORY: Key Management Errors"
references:
- https://owasp.org/Top10/A02_2021-Cryptographic_Failures
subcategory:
- audit
likelihood: LOW
impact: LOW
confidence: LOW
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
vulnerability_class:
- Cryptographic Issues
languages:
- hcl
severity: WARNING
Examples
gcp-pubsub-encrypted-with-cmk.tf
# fail
# ruleid: gcp-pubsub-encrypted-with-cmk
resource "google_pubsub_topic" "fail" {
name = "example-topic"
}
# ok: gcp-pubsub-encrypted-with-cmk
resource "google_pubsub_topic" "pass" {
name = "example-topic"
kms_key_name = google_kms_crypto_key.crypto_key.id
}
Short Link: https://sg.run/544X