Interview Prep/DevSecOps/Secrets and Identity Management

A service account token from a GCP project has been found on a public paste site. What do you do?

IntermediateScenarioSecrets and Identity Management
Answer

Situation read → A JSON service account key is long-lived. It stays valid until someone deletes it.

What I'd do →

  1. Identify the key ID from the JSON and delete it: gcloud iam service-accounts keys delete KEY_ID [email protected].
  2. Review Cloud Audit Logs filtered on that principal for the exposure window.
  3. Check for persistence: new keys, new service accounts, IAM binding changes, new compute instances.
  4. Replace keys with Workload Identity Federation for the system that used it.
  5. Enforce the org policy iam.disableServiceAccountKeyCreation.

Why → Attackers create their own persistence fast, so deleting the leaked key alone is not enough.

Interview tip → Always mention hunting for persistence after a credential leak.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Secrets and Identity Management