A developer pushed an image with an embedded `.env` file to a public Docker Hub repository. How do you respond?
BeginnerScenarioIncident Response and Governance
Answer
Situation read → Public images are scraped by bots quickly. Treat every secret in it as leaked.
What I'd do →
- Rotate every credential in the
.envfile first. - Make the repository private or delete the tag; deletion does not undo downloads.
- Check logs of the affected services for use of the leaked credentials.
- Add a
.dockerignorewith.env, and scan images for secrets in CI:trivy image --scanners secret myorg/app:1.2.0 - Restrict who can push to public namespaces.
Why → Rotation is the only real fix; removal only limits further exposure.
Interview tip → Say "rotate first, clean up second" clearly.
More on Incident Response and Governance
You find a ransom note in an S3 bucket and most objects have been deleted. What do you do in the first hour?AdvancedYour company has its first real security incident and people are all talking at once in Slack. How do you organise the response?BeginnerAn EC2 instance is confirmed compromised. A colleague wants to terminate it immediately. What do you do instead?IntermediateFalco reports a reverse shell from a pod in EKS. How do you contain it while keeping evidence?AdvancedAfter a security incident, leadership wants to know who to blame. How do you run the post-incident review?BeginnerYou are asked to run a security tabletop exercise for the engineering team. How do you design it?Intermediate