More Info:
Ensures that logging and log alerts exist for storage permission changes. Storage permissions include access to the buckets that store the logs, any changes in storage permissions should be heavily monitored to prevent unauthorized changes.Risk Level
HighAddress
SecurityCompliance Standards
HIPAA PCITriage and Remediation
- Remediation
Remediation
Using Console
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.
Once you have:
1. Enable Audit Logs for Google Cloud Storage
- Sign in to the Google Cloud Console.
- Make sure you have selected the correct project (top-left project selector).
- In the left navigation menu, go to:
IAM & Admin → Audit Logs. - In the “Audit Logs” page:
- In the Service list, locate and select:
“Cloud Storage” (sometimes listed as “Storage” or “storage.googleapis.com”).
- In the Service list, locate and select:
- You will see log types for this service:
- Admin Read
- Admin Write
- Data Read
- Data Write
- 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).
- 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:- In the left navigation menu, go to:
Logging → Logs Router. - 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.
- 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.
- 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).
- Under “Choose logs to include in the sink”, set a filter such as:
- Click Create sink.
3. Confirm Logs for Storage Permissions Are Appearing
- Go to Logging → Logs Explorer.
- In the query box, use a filter like:
- Click Run query.
- Inspect entries:
- Look for
protoPayload.methodNamevalues 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.
- Look for
4. (Optional) Narrow to a Specific Bucket / Project
If the misconfiguration is flagged for a specific bucket:- In the Logs Explorer query, further filter:
- Confirm that both:
- Permission changes (
setIamPolicy,update), and - Access operations (
get,list,insert, etc.)
are present.
- Permission changes (
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,
Using CLI
Using CLI
Below are concise, CLI‑only steps to enable Storage permissions logging (audit logging for Cloud Storage IAM & access) in GCP.Notes:This enables:This remediates the “Storage Permissions Logging” gap by ensuring Cloud Storage access and permission changes are captured via Cloud Audit Logs.
1. Set project ID
2. Export current IAM policy
3. Edit IAM policy to add audit logging for Cloud Storage
Openiam-policy.json in an editor and add / merge this auditConfigs block at the top level (alongside bindings):- If
auditConfigsalready exists, just append or merge thestorage.googleapis.comentry into the array. - Keep the rest of the file unchanged.
4. Apply the updated IAM policy
- 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:Using Python
Using Python
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”.
Grant it
You should see something like:If your tool checks multiple buckets, loop over all non-logging buckets and call
1. Prerequisites
- Install the client library:
- Authenticate:
- Ensure your service account / ADC has
storage.buckets.updateon the target bucket andstorage.buckets.geton 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.comGrant 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
enable_bucket_access_logging for each.Using Terraform
Using Terraform
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.
