Logging metric filter and alert for audit configuration changes are not configured Affecting Monitor service in Google


Severity

0.0
medium
0
10
Severity Framework
Snyk CCSS
Rule category
Logging/ Logging

Is your environment 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
CIS-GoogleCSA-CCMHIPAAISO-27001NIST-800-53PCI-DSS
  • Snyk IDSNYK-CC-00435
  • creditSnyk Research Team

Description

Audit logs in Google Cloud capture admin and data access activity. These logs aid security analysis, track resource changes, and ensure compliance. Setting up metric filters and alerts for audit config changes prevents unauthorized or accidental modifications that could hinder investigations or audits.

How to fix?

Ensure a google_logging_metric and google_monitoring_alert_policy are configured for audit configuration changes.

Example Configuration

resource "google_logging_metric" "allowed" {
  name   = "audit_config_alert"
  filter = "protoPayload.methodName=\"SetIamPolicy\" AND protoPayload.serviceData.policyDelta.auditConfigDeltas:*"

  metric_descriptor {
    value_type  = "INT64"
    metric_kind = "DELTA"
    unit        = "1"
  }
}

resource "google_monitoring_alert_policy" "allowed" {
  depends_on   = [google_logging_metric.allowed]
  display_name = "Alert Policy"
  combiner     = "OR"
  conditions {
    display_name = "condition"
    condition_threshold {
      filter     = "resource.type=\"global\" metric.type=\"logging.googleapis.com/user/audit_config_alert\""
      duration   = "60s"
      comparison = "COMPARISON_GT"
    }
  }
}