An access key for an IAM user was committed to a public GitHub repo 20 minutes ago. Walk through your response.
IntermediateScenarioIAM, Organizations and Multi-Account
Answer
Situation read → Assume it is already scraped; speed matters more than forensics at first, but preserve evidence.
What I'd do →
- Deactivate the key immediately:
aws iam update-access-key --user-name ci-bot --access-key-id AKIA... --status Inactive - Attach an explicit deny-all policy or use the AWSCompromisedKeyQuarantine policy AWS may have applied
- Query CloudTrail for the key id over the exposure window for unusual calls like
RunInstancesin odd regions - Terminate rogue resources, check for new IAM users, roles and access keys
- Create a replacement via a role or OIDC, then delete the old key and purge it from git history
Why → Deactivate before delete so you can still audit the key and roll back if a legitimate system breaks.
Interview tip → Mention enabling secret scanning push protection to prevent a repeat.
More on IAM, Organizations and Multi-Account
A developer needs read-only access to one S3 bucket from their laptop. How do you grant it without creating long-lived access keys?BeginnerAn EC2 application needs to write to DynamoDB. Where do the credentials come from?BeginnerSecurity wants to know who deleted a production S3 bucket yesterday. How do you find out?BeginnerYou must stop anyone in a member account from disabling CloudTrail, even account admins. What do you use?BeginnerA cross-account role assumption fails with AccessDenied even though the target role trusts the source account. What do you check?IntermediateDesign access for a CI pipeline in GitHub Actions to deploy to AWS without storing AWS keys in GitHub.Intermediate