A developer's GitHub account was compromised and the attacker pushed a commit to `main` that adds a postinstall script. What now?
AdvancedScenarioIncident Response and Governance
Answer
Situation read → Source compromise. The malicious code may have been built, published and deployed already.
What I'd do →
- Suspend the user in the org, revoke their sessions, PATs, SSH keys and OAuth app grants.
- Revert the commit, and stop CI and deployments for affected repos.
- Identify every artifact built from the bad commit (CI run logs, image digests, published packages) and block or unpublish them.
- Roll back deployments to the last known good digest; rotate secrets that the CI job could read.
- Review the org audit log for other actions by that account (new deploy keys, webhooks, branch protection changes).
- Close the gap: require PRs with review on
main, signed commits, and phishing-resistant MFA (passkeys).
Why → The commit is the smallest part; the artifacts it produced and the access it used are the real exposure.
Interview tip → Mention auditing the GitHub org audit log for persistence.
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