More Info:
Ensures that logging and log alerts exist for project ownership assignments and changes. Project Ownership is the highest level of privilege on a project, any changes in project ownership should be heavily monitored to prevent unauthorized changes.Risk Level
HighAddress
SecurityCompliance Standards
- CIS GCP
- CIS GCP 2.0.0
- Cloudanix Best Practice
- HIPAA
- HITRUST CSF
- ISO 27001
- Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
To remediate “Project Ownership Logging” in GCP using the Console, you want to ensure that all changes to IAM (especially project owners) are logged and retained outside the project (per CIS 1.1).Below are concise step‑by‑step instructions.
Adjust roles per your environment.
Once this is in place for all relevant projects (or configured at folder/org level), the “Project Ownership Logging” / “Project ownership logging and monitoring” finding in most security or CIS benchmarks will be considered remediated for GCP IAM.
1. Confirm Audit Logs Are Enabled for IAM
Admin Activity logs (which include IAM changes) are on by default and cannot be turned off, but verify their presence:- Go to Logging:
Navigation menu → Logging → Logs Explorer - In the query editor, run something like:
- Click Run query.
- If you see recent entries, IAM changes (including ownership changes) are being logged.
2. Create a Central Log Bucket / Project (recommended)
If you already have a central logging project/bucket, skip to section 3.- (Optional but recommended) Create a central logging project (e.g.,
org-logging-prod) and do the rest of these steps there. - In that project, go to
Navigation menu → Logging → Log storage - Click Create Log Bucket:
- Name:
project-ownership-audit-logs - Location: choose region or multi-region as per policy
- Retention: configure per policy (e.g., 365 days or longer)
- Name:
- Click Create.
3. Create a Log Sink for Project Ownership / IAM Changes
Do this in each project where you want to remediate the finding (or at folder/org level if you have the rights).- Switch to the source project you want to protect.
-
Go to
Navigation menu → Logging → Log Router - Click Create sink.
-
Configure:
- Sink name:
project-ownership-logging-sink - Sink description:
Exports IAM and project ownership change logs
- Sink name:
-
Sink destination:
- Choose where to send logs:
- Log bucket: select the central log bucket you created (may be in another project).
- Click Select sink destination → Cloud Logging bucket → choose project and bucket (e.g.,
org-logging-prod / project-ownership-audit-logs).
- Click Select sink destination → Cloud Logging bucket → choose project and bucket (e.g.,
- Alternatively, you can choose BigQuery dataset or Cloud Storage if your policy requires that.
- Log bucket: select the central log bucket you created (may be in another project).
- Choose where to send logs:
-
Choose logs to include (this is key):
In the Build inclusion filter box, use a filter that captures IAM changes, especially role/owner changes, for this project. Example:
Replace
YOUR_PROJECT_IDwith your project ID. This ensures all project-level IAM policy changes—including ownership/role assignment changes—are exported. - Click Create sink.
-
When prompted to Grant Writer Identity:
- The system shows a service account of the form
cloud-logs@system.gserviceaccount.comorserviceAccount:logging-XXXX@gcp-sa-logging.iam.gserviceaccount.com(depending on target). - Grant that service account the appropriate writer role on the destination:
- If destination is a log bucket:
- On the destination project, go to
IAM & Admin → IAM - Add the sink’s service account with role:
Logging → Logs Bucket Writer(orLogs Writerif using legacy).
- On the destination project, go to
- If BigQuery: grant
BigQuery Data Editoron the dataset. - If Cloud Storage: grant
Storage Object Creatoron the bucket.
- If destination is a log bucket:
- The system shows a service account of the form
4. (Optional) Narrow to Owner‑Level Role Changes Only
If your auditor requires only changes involving owner‑equivalent roles, you can further refine the sink filter:5. Verify Logs Are Reaching the Destination
-
Go to the destination (log bucket / BigQuery / GCS):
- For Log bucket:
Navigation menu → Logging → Logs Explorer- In the project that owns the bucket, filter by:
- For BigQuery:
- Query the table to confirm new rows appear when IAM changes are made.
- For GCS:
- Check objects in the bucket are being created.
- For Log bucket:
- Make a test IAM change (e.g., add/remove a role) and confirm it appears in the destination within a few minutes.
Once this is in place for all relevant projects (or configured at folder/org level), the “Project Ownership Logging” / “Project ownership logging and monitoring” finding in most security or CIS benchmarks will be considered remediated for GCP IAM.
Using CLI
Using CLI
To remediate “Project Ownership Logging” for GCP IAM using the CLI, you need to enable Cloud Audit Logs (Admin Activity + Data Access) in the project IAM policy.Below are step‑by‑step
If
Verify there are no errors.
You should see
gcloud commands.1. Set your project
2. Export the current IAM policy
3. Edit IAM policy to add audit logging
Openiam-policy.json in an editor and add (or merge) the auditConfigs block.If auditConfigs doesn’t exist, add it at the top level:auditConfigs already exists, ensure there is an entry with "service": "allServices" (or "iam.googleapis.com") including the three logType values above.This configuration ensures IAM (including project owner / role changes) is logged.4. Apply the updated IAM policy
5. (Optional) Verify audit configs
ADMIN_READ, DATA_READ, and DATA_WRITE under allServices (or specifically iam.googleapis.com).This enables logging of project ownership and other IAM changes for the project.Using Python
Using Python
Below are step‑by‑step instructions and a Python example to remediate “Project Ownership Logging” for GCP IAM (as in CIS GCP Benchmark: log all project owner changes).
Or Pub/Sub:Or log bucket (same project):Create the destination resource beforehand (dataset / topic / log bucket).
If you specifically care about project “Owner” role changes, you can refine to role Replace
(or use IAM policy binding to the dataset’s service account writer_identity).
If you tell me:
Goal
Ensure that any changes to project ownership / IAM policy are logged and exported (e.g., to a log bucket, BigQuery, or Pub/Sub) so they can’t be lost.This is done by:- Creating (or verifying) a log sink at the project level.
- Using a filter that matches IAM / ownership changes.
- Ensuring the sink’s destination exists and the sink has permission to write to it.
1. Decide where to export the logs
Common options:- A log bucket in the same project
- A BigQuery dataset
- A Pub/Sub topic
2. Use a logging filter that captures IAM / ownership changes
Recommended filter (covers IAM policy changes for the project):roles/owner:PROJECT_ID accordingly if you hard‑code it.3. Python example: create or update a log sink
Prerequisites
Code
4. Grant sink writer permissions on the destination
After running the script, note thewriter_identity printed (something like serviceAccount:cloud-logs@system.gserviceaccount.com or serviceAccount:...gcp-sa-logging.iam.gserviceaccount.com).Grant it appropriate IAM on the destination:- BigQuery dataset:
roles/bigquery.dataEditororroles/bigquery.dataOwner - Pub/Sub topic:
roles/pubsub.publisher - Log bucket:
roles/logging.bucketWriteron that bucket
If you tell me:
- your chosen destination type (BigQuery / Pub/Sub / log bucket), and
- whether you want only owner role changes or all IAM changes
Using Terraform
Using Terraform
terraform plan should show + create for:google_logging_metric.project_ownership_changegoogle_monitoring_notification_channel.project_ownership_emailgoogle_monitoring_alert_policy.project_ownership_change_alert.

