Skip to main content

Triage and Remediation

Remediation

Using Console

To fix “Storage Permissions Logging” for Google Cloud Storage using the GCP Console, you essentially need to ensure that Cloud Audit Logs (especially Data Access logs) are enabled for Google Cloud Storage and that they are being routed to a log destination you retain.Below are the step‑by‑step instructions in the Console.

1. Enable Audit Logs for Google Cloud Storage

  1. Sign in to the Google Cloud Console.
  2. Make sure you have selected the correct project (top-left project selector).
  3. In the left navigation menu, go to:
    IAM & Admin → Audit Logs.
  4. In the “Audit Logs” page:
    • In the Service list, locate and select:
      “Cloud Storage” (sometimes listed as “Storage” or “storage.googleapis.com”).
  5. You will see log types for this service:
    • Admin Read
    • Admin Write
    • Data Read
    • Data Write
  6. For comprehensive permissions logging:
    • Check Admin Read and Admin Write (if not already enabled).
    • Check Data Read and Data Write (these are typically off by default and are crucial for object/permission access logging).
  7. Click Save at the bottom of the page.
This ensures that actions on buckets/objects and permission changes are written to Cloud Audit Logs.

2. Verify Logs Are Being Stored (Log Router / Sinks)

Audit logs automatically go to Cloud Logging, but compliance often requires storing them longer (e.g., in a bucket, BigQuery, or Pub/Sub). To route them properly:
  1. In the left navigation menu, go to:
    Logging → Logs Router.
  2. Look for an existing sink that captures audit logs (especially from cloudaudit.googleapis.com).
    • If one exists and routes to a storage bucket/BigQuery with sufficient retention for your requirements, you may not need to change anything.
  3. To create a dedicated sink (if needed):
    • Click Create sink.
    • Sink name: e.g., gcs-audit-logs-sink.
    • Sink destination: choose one, commonly:
      • Cloud Storage bucket (recommended for archive),
      • or BigQuery (for querying),
      • or Pub/Sub (for streaming/forwarding).
    • Click Next.
  4. Choose logs to include:
    • Under “Choose logs to include in the sink”, set a filter such as:
    • This captures Storage audit logs (including permission changes and access).
  5. Click Create sink.

3. Confirm Logs for Storage Permissions Are Appearing

  1. Go to Logging → Logs Explorer.
  2. In the query box, use a filter like:
  3. Click Run query.
  4. Inspect entries:
    • Look for protoPayload.methodName values related to IAM or ACL changes (e.g., storage.setIamPermissions, storage.objects.get, storage.buckets.update, etc.).
    • Confirm that these actions on your buckets are being logged.

4. (Optional) Narrow to a Specific Bucket / Project

If the misconfiguration is flagged for a specific bucket:
  1. In the Logs Explorer query, further filter:
  2. Confirm that both:
    • Permission changes (setIamPolicy, update), and
    • Access operations (get, list, insert, etc.)
      are present.

Once you have:
  • Enabled Admin and Data Access audit logs for Cloud Storage in IAM & Admin → Audit Logs, and
  • Ensured they are routed and stored via a Logs Router sink,
the “Storage Permissions Logging” finding for GCP Storage should be remediated.
Below are concise, CLI‑only steps to enable Storage permissions logging (audit logging for Cloud Storage IAM & access) in GCP.

1. Set project ID

2. Export current IAM policy

3. Edit IAM policy to add audit logging for Cloud Storage

Open iam-policy.json in an editor and add / merge this auditConfigs block at the top level (alongside bindings):
Notes:
  • If auditConfigs already exists, just append or merge the storage.googleapis.com entry into the array.
  • Keep the rest of the file unchanged.

4. Apply the updated IAM policy

This enables:
  • ADMIN_READ logs: IAM / permission changes on Cloud Storage.
  • DATA_READ logs: reads of bucket/objects.
  • DATA_WRITE logs: writes/deletes of bucket/objects.

5. (Optional) Verify audit logs

Use Cloud Logging to confirm logs are being generated:
This remediates the “Storage Permissions Logging” gap by ensuring Cloud Storage access and permission changes are captured via Cloud Audit Logs.
Below is how to remediate “Storage Permissions Logging” for a Google Cloud Storage bucket using Python, assuming the finding means “bucket access logging is not enabled”.

1. Prerequisites

  1. Install the client library:
  2. Authenticate:
  3. Ensure your service account / ADC has storage.buckets.update on the target bucket and storage.buckets.get on the log bucket.

2. Create (or choose) a logging bucket

You need a separate bucket to receive access logs.

3. Grant write permission for logging

GCS uses a special writer identity to store logs: cloud-storage-analytics@google.com
Grant it roles/storage.objectCreator on the log bucket.

4. Enable logging on the source bucket

This sets the log destination bucket and an optional log object prefix.

5. Verify configuration

You should see something like:
If your tool checks multiple buckets, loop over all non-logging buckets and call enable_bucket_access_logging for each.
Enabling the logging block does not force replacement of the existing bucket; Terraform will show an in-place update on google_storage_bucket.app_data adding logging.log_bucket and logging.log_object_prefix, and creation of google_storage_bucket.app_data_logs if it does not yet exist.