A developer pushed an AWS access key to a public repo 10 minutes ago. What is your first move?
BeginnerScenarioSecrets, Signing and Security
Answer
Situation read → Bots scan public pushes within seconds. Assume the key is already compromised.
What I'd do →
- Revoke or deactivate the key in IAM immediately; create a replacement and deploy it.
- Review CloudTrail for use of the key since the push; check for new users, instances and unusual regions.
- Only then clean the repo (remove from history, see the next question).
- Write up the incident and add push protection and a pre-commit scanner.
Why → Deleting the commit does not undo exposure. Rotation does.
Interview tip → "Rotate first, clean second" is the sentence interviewers listen for.
More on Secrets, Signing and Security
After rotating the leaked key, you must purge it from repository history. How?AdvancedA push is rejected: "GH013: Repository rule violations found ... Push cannot contain secrets". What do you do?IntermediateSecret scanning alerts have piled up, and many look like false positives or old test credentials.IntermediateYou must set up signed commits on your laptop. Which method do you pick?BeginnerYour GPG signing key expires next week. What is the correct way to handle it?IntermediateA release bot pushes commits, and branch rules require signed commits. How do you handle it?Intermediate