GCP service account with user-managed keys
A GCP service account can have user-managed JSON keys. These are long-lived secrets that frequently end up in source code, CI config or developer laptops — and rarely get rotated.
Why it matters
A leaked service account key is a standing credential an attacker can use until someone notices and revokes it; many breaches trace back to one.
Keyless options (Workload Identity, attached service accounts, Workload Identity Federation) remove the secret entirely.
How to check for it
- gcloud iam service-accounts keys list --iam-account=<sa-email> --managed-by=user — any user-managed key is a long-lived credential.
- Scan repos and CI for service_account .json key material.
How to fix it
- Delete user-managed keys and switch workloads to Workload Identity (GKE), attached service accounts (GCE/Cloud Run), or Workload Identity Federation (outside GCP).
- If a key is unavoidable, rotate it on a schedule and store it only in Secret Manager.
SkyShield checks this automatically
Connect your AWS, Cloudflare, GitHub, GitLab, Hetzner or DigitalOcean account read-only and SkyShield flags this across every account and region, with the fix in plain words — alongside the agent that watches your servers. Start free.
FAQ
- What is Workload Identity Federation?
- It lets workloads outside Google Cloud (GitHub Actions, AWS, on-prem) exchange their own identity token for short-lived GCP credentials — no downloadable key.