terraform.gcp.security.gcp-bigquery-table-encrypted-with-cmk.gcp-bigquery-table-encrypted-with-cmk
semgrep
Author
unknown
Download Count*
License
Ensure Big Query Tables are encrypted with Customer Supplied Encryption Keys (CSEK)
Run Locally
Run in CI
Defintion
rules:
- id: gcp-bigquery-table-encrypted-with-cmk
patterns:
- pattern: |
resource "google_bigquery_table" $ANYTHING {
...
}
- pattern-not-inside: |
resource "google_bigquery_table" $ANYTHING {
...
encryption_configuration {
...
kms_key_name = ...
...
}
...
}
message: "Ensure Big Query Tables are encrypted with Customer Supplied
Encryption Keys (CSEK)\t"
metadata:
category: security
technology:
- terraform
- gcp
owasp:
- A03:2017 - Sensitive Data Exposure
cwe:
- "CWE-320: CWE CATEGORY: Key Management Errors"
references:
- https://docs.bridgecrew.io/docs/google-cloud-policy-index
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-bigquery-table-encrypted-with-cmk.tf
# fail
# ruleid: gcp-bigquery-table-encrypted-with-cmk
resource "google_bigquery_table" "fail" {
dataset_id = google_bigquery_dataset.default.dataset_id
table_id = "sheet"
external_data_configuration {
autodetect = true
source_format = "GOOGLE_SHEETS"
google_sheets_options {
skip_leading_rows = 1
}
source_uris = [
"https://docs.google.com/spreadsheets/d/123456789012345",
]
}
}
# ok: gcp-bigquery-table-encrypted-with-cmk
resource "google_bigquery_table" "pass" {
dataset_id = google_bigquery_dataset.default.dataset_id
table_id = "sheet"
external_data_configuration {
autodetect = true
source_format = "GOOGLE_SHEETS"
google_sheets_options {
skip_leading_rows = 1
}
source_uris = [
"https://docs.google.com/spreadsheets/d/123456789012345",
]
}
encryption_configuration {
kms_key_name = var.kms_key_name
}
}
Short Link: https://sg.run/49Jx