Security Incident Response for Developers: What to Do When Something Goes Wrong

A practical incident response playbook for engineering teams: detection, triage, containment, credential rotation, evidence preservation, communication.

Published December 6, 2026

A leaked API key on GitHub, a suspicious admin login at 3 a.m., a compromised dependency in your build: security incidents rarely announce themselves politely. Teams that have a simple, rehearsed playbook contain damage in minutes; teams that improvise can turn a small leak into a breach. You do not need a large security team to respond well.

The concept

Incident response follows recognisable phases: preparation (logging, contacts, playbooks, access to rotate secrets), detection and analysis (confirm it is real, scope what is affected), containment (stop the bleeding: revoke credentials, isolate hosts, disable compromised accounts or features), eradication and recovery (remove the cause, patch, restore from known-good state, monitor), and post-incident review.

Two principles matter most in the first hour. First, contain before you investigate deeply: rotate the leaked key immediately rather than first proving whether it was used. Second, preserve evidence: snapshot affected systems and keep logs before cleaning up, because you will need them to understand scope and meet legal or customer notification obligations.

Phases

  1. Detect: alert, report or scanner finding
  2. Triage: is it real? what is affected? severity?
  3. Contain: rotate secrets, block access, isolate systems
  4. Eradicate & recover: fix root cause, restore, monitor
  5. Review: blameless postmortem, follow-up actions
The incident response lifecycle.

First moves by scenario

ScenarioImmediate containment
Secret committed to a public repoRevoke/rotate now; then check usage logs
Compromised developer laptopRevoke sessions, tokens, SSH keys; rotate secrets it held
Malicious dependency installedPin safe version, rotate CI/developer secrets exposed during install
Suspicious admin activityDisable account, revoke sessions, preserve audit logs
Exploited vulnerability in productionMitigate (WAF rule, feature flag, patch), snapshot evidence

Roles in an incident

DetectorIncident leadEngineersStakeholdersalert: leaked AWS keyrotate key, check CloudTrailkey used from unknown IPcontain: revoke roles, block IPstatus update every 30 minscope confirmed, recovery done
Clear roles keep response fast.

Practical examples

Rotate a leaked cloud key (AWS example)

Deactivate first, then investigate.

aws iam update-access-key --user-name ci-deployer --access-key-id AKIA... --status Inactive
aws iam create-access-key --user-name ci-deployer          # if a key is still needed (prefer OIDC)
aws cloudtrail lookup-events --lookup-attributes AttributeKey=AccessKeyId,AttributeValue=AKIA... --max-results 50

Incident channel template

Consistent structure for updates.

Incident: SEC-2026-11-30-01  Severity: High  Lead: @oncall-security
Status: Contained (key revoked 10:42 IST)
Impact: investigating; no customer data access found so far
Next update: 11:30 IST

Preserve evidence before cleanup

Snapshot disks and export logs.

aws ec2 create-snapshot --volume-id vol-0abc... --description "SEC-2026-11-30-01 evidence"
kubectl logs deploy/api --since=24h > evidence/api-logs.txt

Common mistakes

  • Investigating for hours before rotating an obviously leaked secret.
  • Wiping and rebuilding systems before preserving evidence.
  • No designated incident lead, so everyone does everything.
  • Skipping the postmortem once things are working again.

Key takeaways

  • Prepare: logging, playbooks, contacts and rotation access.
  • Contain first: revoke, rotate, isolate.
  • Preserve evidence and communicate on a schedule.
  • Learn with blameless postmortems and tracked follow-ups.

FAQ

When must we notify customers or regulators?

It depends on jurisdiction and contracts (for example GDPR and India's DPDP Act have notification rules); involve legal counsel early when personal data may be affected.

Should we pay attention to small incidents?

Yes. Small incidents are practice for big ones and often reveal systemic gaps.

How do we practise?

Tabletop exercises: walk through a scenario as a team, using the real playbook and tools.

More Security articles