Users should not hold Service Account User or Token Creator at project level
This check looks at the IAM policy of each project for the Service Account User and Service Account Token Creator roles granted to users. The safe setting is that these roles are granted on individual service accounts, not on the whole project.
Why it matters
Both roles let a person act as a service account. At project level, that means acting as every service account in the project, including ones with much higher privileges than the person has, now or in the future. Granting the role on the specific service account keeps the reach small. Google explains this in its guidance: best practices for service accounts and service account permissions.
A common way this goes wrong is a convenience grant: someone needs to deploy one Cloud Run service as a specific service account, receives the role on the whole project, and the grant stays long after the task is done. Every service account created later in that project is silently included.
How to check it yourself
In the Google Cloud console open IAM & Admin, then IAM, and filter the role column for Service Account User and Service Account Token Creator. Any user listed there at project level is a finding. Read-only command:
gcloud projects get-iam-policy <project-id> \
--flatten="bindings[].members" \
--filter="bindings.role:(roles/iam.serviceAccountUser OR roles/iam.serviceAccountTokenCreator)" \
--format="table(bindings.role, bindings.members)"How to fix it
For each user found, first note which service account they really need, then grant the role on that service account only and remove the project-level binding.
gcloud iam service-accounts add-iam-policy-binding <sa-email> \
--member="user:<user-email>" --role="roles/iam.serviceAccountUser"
gcloud projects remove-iam-policy-binding <project-id> \
--member="user:<user-email>" --role="roles/iam.serviceAccountUser"Repeat with roles/iam.serviceAccountTokenCreator where needed. ConfigCobra only reads your environment and never changes it; the steps below are for you or your administrator to run.
What changes when you fix it
People who deploy workloads that run as a service account, or who impersonate one for testing, lose that ability on service accounts they were not granted. Grant the narrow binding before removing the broad one so nobody is blocked. Running workloads and the service accounts themselves are not affected.
To avoid surprises, list the current bindings across your projects first, ask each person which service account they really use, and add the narrow bindings before you remove the broad ones. Review at the same time whether the person still needs to act as a service account at all. The remediation impact view in ConfigCobra lists the affected identities and resources before you apply a fix.
Included in
| Benchmark | CIS ID | Profile |
|---|---|---|
| CIS Google Cloud Platform Foundation v5.0.0 | 1.7 | Level 1 |
More checks in Identity and Access Management
- Use corporate-managed login credentials instead of consumer accountsCIS 1.2
- Enforce multi-factor authentication for all non-service accountsCIS 1.3
- Enforce security-key two-factor authentication for all admin accountsCIS 1.4
- Use only GCP-managed keys for each service account (no user-managed keys)CIS 1.5
- Ensure service accounts hold no admin (owner/editor) privilegesCIS 1.6
Go further
- Identity and Access Management21 controls in this section
- CIS Google Cloud Platform Foundation v5.0.093 controls
- CIS Google Cloud Platform Foundation checklistEvery control in one list, as CSV
- RemediationSee what a fix changes in your tenant before you apply it, then use the generated script
- Monitoring & DriftDaily scans, drift detection and email alerts when a control regresses
Check this on your Google Cloud
ConfigCobra runs this check with every other control of the CIS Google Cloud Platform Foundation Benchmark, read-only.