❑ Basic roles include thousands of permissions across all Google Cloud services. In production environments, do not grant basic roles unless there is no alternative. Instead, grant the most limited
for each of the services, then grant only the required permissions to each service account.
❑ Remember that the allow policies for child resources inherit from the allow policies for their parent resources. For example, if the allow policy for a project grants a user the ability to administer Compute Engine virtual machine (VM) instances, then the user can administer any Compute Engine VM in that project, regardless of the allow policy you set on each VM.
❑ Grant roles at the smallest scope needed. For example, if a user only needs access to publish Pub/Sub topics, grant the
. Users who are granted the Service Account User role for a service account can access all the resources to which the service account has access. Therefore, be cautious when granting the Service Account User role to a user.
❑ Specify who has access to create and manage service accounts in your project.
(roles/owner) role to a principal will allow them to access and modify almost all resources, including modifying allow policies. This amount of privilege is potentially risky. Grant the Owner role only when (nearly) universal access is required.
. Ensure that service accounts have limited privileges, and protect against potential security threats.
❑ Do not delete service accounts that are in use by running instances. This could result in all or parts of your application to fail if you have not transitioned to using an alternative service account first.
❑ Use the display name of a service account to keep track of what the service account is used for and what permissions it needs.
Service account keys
❑ Avoid using service account keys if another option is available. Service account keys are a security risk if not managed correctly. You should
whenever possible. If you must authenticate with a service account key, you are responsible for the security of the private key and for other operations described by
. If you are prevented from creating a service account key, service account key creation might be disabled for your organization. For more information, see
. You can rotate a key by creating a new key, switching applications to use the new key, disabling the old key, and then deleting the old key when you are sure that it is no longer needed.
❑ Be careful not to confuse encryption keys with service account keys. Encryption keys are typically used to encrypt data and service account keys are used for secure access to Google Cloud APIs.
❑ Don't check in the service account keys into the source code or leave them in the Downloads directory.
❑ Grant roles to groups instead of individual users when possible. It is easier to update the members of a group than to update the principals in your allow policies.