Ensure that "Disable Automatic IAM Grants for Default Service Accounts" policy is enforced for your Google Cloud Platform (GCP) organizations and projects in order to deactivate the automatic IAM role grant for default service accounts.
This rule resolution is part of the Conformity Security & Compliance tool for GCP.
There are Google Cloud services that require you to create default service accounts for your GCP projects. When a default service account is created, it is automatically granted the Editor role ("roles/editor") on your project. To enhance access security and meet compliance requirements, it is strongly recommended to disable the automatic IAM role grant. Use the "Disable Automatic IAM Grants for Default Service Accounts" (i.e. "iam.automaticIamGrantsForDefaultServiceAccounts") constraint to disable the automatic role grant for all the projects created within your organization.
Audit
To determine if "Disable Automatic IAM Grants for Default Service Accounts" policy is enforced for your organizations and projects, perform the following operations:
Remediation / Resolution
To ensure that the automatic IAM role grant for default service accounts is disabled within your Google Cloud organization, enable the “Disable Automatic IAM Grants for Default Service Accounts” organization policy by performing the following operations:
References
- Google Cloud Platform (GCP) Documentation
- Organization policy constraints
- Using constraints
- Creating and managing organization policies
- Restricting service account usage
- GCP Command Line Interface (CLI) Documentation
- gcloud organizations list
- gcloud alpha resource-manager org-policies describe
- gcloud alpha resource-manager org-policies enable-enforce