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 →
- Identify the key ID from the JSON and delete it:
gcloud iam service-accounts keys delete KEY_ID [email protected]. - Review Cloud Audit Logs filtered on that principal for the exposure window.
- Check for persistence: new keys, new service accounts, IAM binding changes, new compute instances.
- Replace keys with Workload Identity Federation for the system that used it.
- 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.
More on Secrets and Identity Management
A team stores database passwords in a `.env` file committed to a private repo. How do you migrate them out?BeginnerYour CI pipeline uses long-lived AWS access keys stored as repository secrets. How do you replace them?IntermediateAn auditor asks how often you rotate database credentials. You currently never do. What do you build?IntermediatePods need AWS access. A developer mounted an IAM user's keys as a Kubernetes Secret. What do you propose instead?BeginnerShould you use Kubernetes Secrets, Sealed Secrets, External Secrets Operator or the Secrets Store CSI driver?IntermediateA Slack webhook URL and a Stripe live key were posted in a public GitHub issue. What is your response sequence?Beginner