Incident Response Runbook
Purpose
This runbook provides specific response procedures for security incidents affecting this repository and its infrastructure. Each playbook is tailored to the actual architecture (GitHub, Cloudflare Pages, static Docusaurus site).
Playbook 1: GitHub Token Compromised
Detection
Canary token alert, unexpected repository activity in audit log monitor, or notification from GitHub.
Response
- Go to GitHub Settings, Developer settings, Personal access tokens
- Revoke the compromised token immediately
- Check recent repository activity:
gh api repos/newcomb-labs/engineering-journal-kb/events --jq '.[].type' - Review commits for unauthorized changes:
git log --oneline --since="24 hours ago" - Check for new collaborators, deploy keys, or webhooks
- Generate a new token with minimum required scopes
- Update GitHub Actions secrets if the token was used in CI
- Update the Secret Rotation Schedule
Recovery time: minutes
Playbook 2: Dependency Backdoored
Detection
Dependabot alert, dependency-audit workflow finding, community advisory, or malware pattern scanner flag.
Response
- Identify the affected package and version
- Check if the package is a direct or transitive dependency:
cd website && npm ls <package> - If direct: pin to the last known good version in package.json
- If transitive: add an npm override to force a safe version
- Run
npm ciandnpm run buildto verify the site builds cleanly - Check the deployed site for any signs of compromise
- Open a PR with the fix, referencing the advisory
- Run the malware pattern scanner:
python3 scripts/scan_malware_patterns.py --path website/
Recovery time: hours
Playbook 3: Unauthorized Repository Access
Detection
Audit log monitor workflow creates an issue, or manual observation of unexpected collaborators/deploy keys.
Response
- Remove unauthorized collaborators:
gh api repos/newcomb-labs/engineering-journal-kb/collaborators/<username> -X DELETE - Remove unauthorized deploy keys via GitHub UI (Settings, Deploy keys)
- Remove unauthorized webhooks via GitHub UI (Settings, Webhooks)
- Review branch protection rules: run
gh workflow run branch-protection-audit.yml - Check recent commits and PRs for unauthorized changes
- Rotate all secrets (follow Secret Rotation Schedule)
- Enable or verify 2FA on the GitHub account
Recovery time: minutes to hours
Playbook 4: Cloudflare Account Compromised
Detection
Unexpected DNS changes, site downtime, certificate warnings, or Cloudflare notification.
Response
- Log into Cloudflare and change the account password immediately
- Verify 2FA is enabled
- Check DNS records for unauthorized changes
- Check WAF rules for tampering
- Check Pages deployments for unauthorized builds
- Revoke and regenerate all Cloudflare API tokens
- Verify SSL/TLS settings (Full Strict, minimum TLS 1.2)
- Contact Cloudflare support if access is lost
- Update the Secret Rotation Schedule
Recovery time: hours (DNS propagation may take up to 48 hours)
Playbook 5: Secret Leaked in Commit
Detection
Gitleaks CI alert, commit message scanner, or manual discovery.
Response
- Do NOT try to remove the commit — it is already in git history
- Immediately revoke the leaked credential in the relevant service
- Generate a new credential
- Update the GitHub Actions secret or environment variable
- Verify all workflows pass with the new credential
- Consider using
git filter-repoor BFG Repo Cleaner to remove from history (optional, only if the repo is not widely cloned) - Update the Secret Rotation Schedule
- Add the pattern to Gitleaks allowlist if it was a canary token
Recovery time: minutes (credential rotation), hours (history cleanup if needed)
Playbook 6: Build Artifact Tampered
Detection
Content integrity checksums mismatch, unexpected content on the deployed site, or user report.
Response
- Trigger a fresh deployment:
gh workflow run deploy-pages.yml - Verify the build output matches expectations
- Check the Cloudflare Pages deployment log for the last deployment
- If the tampering occurred at the CDN level, purge Cloudflare cache
- Review CI workflow logs for the build that produced the tampered artifact
- Check for unauthorized changes to build scripts or docusaurus.config.js
Recovery time: minutes (redeploy)
General Principles
- Revoke first, investigate second
- Document every action taken during the incident
- Notify affected parties if applicable
- Update this runbook with lessons learned after every incident
- Follow the Vulnerability Disclosure Process for external reporting