Runbook: suspected compromise of the deploy path#

For when someone else may be acting through the deploy path: the site shows content nobody merged, a workflow ran that nobody started, a commit on main came from no reviewed pull request, or AWS shows a change no apply made. The threat model puts defacement through the deploy path first among what is in scope. This procedure has not been exercised (limitations).

A taken registrar account is a different procedure: Scenario D of the DNSSEC emergency runbook.

Access:

  • The repository owner's GitHub account, to stop Actions and review who has access.
  • Administrator access to the AWS account, in the console: the root user with MFA, or OrganizationAccountAccessRole. No person holds AWS credentials day to day (identity and access), and revoking the CI roles' sessions is an IAM change no CI role may make.

Who can change what, and with which role, is the picture in identity and access. Every role that writes trusts only a token from main, so whoever can push to main can reach them while main has no protection (limitations).

1. Stop it#

In this order, because the first step stops new runs and the second ends the credentials runs already hold.

  1. Disable Actions for the repository. Settings → Actions → General → Actions permissions → Disable actions. Then cancel any run still in progress (Actions → the run → Cancel workflow run). This stops dns-health and drift-detection too. The hourly probe and the alarm emails run in AWS and keep working.
  2. Revoke the CI roles' active sessions. IAM → Roles → each of testz-gha-plan, testz-gha-apply, testz-gha-deploy and testz-gha-bootstrap → Revoke sessions → Revoke active sessions. AWS attaches an inline policy, AWSRevokeOlderSessions, that denies every session issued before that moment. A session lasts at most an hour, so this matters for the first hour. Sessions issued later are not affected, so CI works again once Actions is enabled. The bootstrap layer does not manage other inline policies, so the policy stays until an administrator deletes it, and it does no harm while it stays.

2. See what it did#

In GitHub:

  • Actions → each workflow's runs: which ran, who started each, from which commit. Note the run IDs of any run nobody started.
  • main's history: every commit since the last one you know is good, and whether a reviewed pull request merged it. Read especially any change under .github/, terraform/bootstrap/, terraform/seed/ and scripts/.
  • Settings → Environments: whether prod, prod-deploy or bootstrap changed, or gained a secret. Settings → Secrets and variables: when each secret was last updated.
  • The account's security log (account Settings → Security log): sign-ins, new tokens, new SSH keys, and apps authorised or installed.

In AWS, CloudTrail → Event history, which keeps 90 days:

  • Filter by User name on the session names the workflows give each role, which carry the run ID: gha-site-<run id> (deploy), gha-apply-<run id> and gha-alarm-test-<run id> (apply), gha-bootstrap-<run id> and gha-seed-cleanup-<run id> (bootstrap), and gha-plan-, gha-apply-plan-, gha-drift- and gha-alarms-<run id> (read-only).
  • Filter by Event name AssumeRoleWithWebIdentity for every session any CI role issued, including one under a session name the workflows do not use.

What each role could have done bounds what to look for: the deploy role, objects in the site bucket and cache invalidations; the apply role, the stack, including certificates, DNS records and new testz-* roles under the permissions boundary; the bootstrap role, the CI roles and their boundary.

3. Put it back#

  1. Revert main to the last good commit, through a pull request that reverts the bad commits. Read the revert's diff for workflow files: they run with the roles as soon as Actions is enabled.
  2. Enable Actions again (Settings → Actions → General).
  3. The site: run site-deploy from main. Its sync deletes every object the build does not produce, except the MTA-STS policy, which OpenTofu owns, and it invalidates the cache. Check that the footer names the commit you reverted to.
  4. The stack: run terraform-apply with plan_digest empty. Any change the plan proposes, you did not make: read it, then apply that plan by its digest (ADR-0025) to put main back.
  5. The CI roles, if the apply or bootstrap role was used: run bootstrap-account with plan_digest empty. A change it proposes is a change to the roles or the boundary; apply it the same way. The bootstrap role cannot change itself, so if it is in doubt, follow changing the seed later.
  6. Run drift-detection from main: a clean run means production matches main and the zone serves no record OpenTofu does not manage.
  7. Run dns-health from main: its Certificate Transparency lines show a certificate issued for a name the site does not serve, which the apply role could have requested.

4. Close the way in#

  • The GitHub account: change its password, check its two-factor settings and recovery codes, and sign out other sessions. Remove any personal access token, SSH key, OAuth app or GitHub App you do not recognise, and review the ones you do: every app with write access to the repository, Renovate among them, can push to main.
  • The repository: collaborators, deploy keys and webhooks.
  • AWS: there are no CI keys to rotate. Check that IAM lists no user, no access key and no role outside the testz-* names, and that the GitHub OIDC provider is the one the seed created.
  • The secrets AWS_ACCOUNT_ID and ALERT_EMAIL are not credentials. If they were read, the alert address can expect phishing.

Afterwards#

Write up what happened in an issue: how they got in, what the logs showed, and what was put back. A control that did not hold goes on the limitations page, and a change to it through a pull request.

Built 2026-12-01 from commit 5f3eb2c4b04f9d8367364b6f4598a05a364e2263. This page was generated from the same source that provisions the infrastructure it describes.