Skip to content

Lesson 9 of 9 · 28m

Release and Supply-Chain Incident Response

Respond to malicious packages, compromised publish credentials, poisoned artifacts, and upstream disclosures with containment, evidence, and safe recovery.

Supply-chain incidents feel chaotic because trust collapses in both directions. You cannot trust the artifact until you know how it was made, and you cannot trust the pipeline until you know whether it made the artifact. The response has to separate containment, evidence preservation, and recovery instead of mashing them together in a panic.

First containment question: what can still execute?

If a malicious artifact may be deployed, stop promotion and execution first:

kubectl scale deploy/payments-api --replicas=0 -n prod
# or freeze rollout automation
argocd app set payments-api --sync-policy none

Exact actions depend on impact. Sometimes scaling down causes more harm than containing network egress. The key is to decide consciously and record who authorized the action.

Preserve evidence before rotating everything

Capture artifact digests, registry metadata, signatures, attestations, audit logs, CI run logs, workflow definitions, package metadata, and deployed manifests:

crane digest ghcr.io/acme/payments-api:v2.4.1
cosign verify ghcr.io/acme/payments-api@sha256:3b8f4e4d... 2>&1 | tee verify.log
cosign tree ghcr.io/acme/payments-api@sha256:3b8f4e4d... | tee attestations.log

Do not overwrite the suspicious artifact with a fixed version before preserving evidence. Do not rerun the same pipeline blindly; it may destroy the only copy of attacker-modified job logs.

Build a blast-radius inventory

Use the SBOM and deployment inventory together:

Which artifacts contain the malicious package?
Which environments run those digests?
Which customer downloads included them?
Which build machines installed the dependency?
Which credentials were present in those builds?

Build-time compromise and runtime compromise are different incidents. A malicious dependency installed only in CI may never enter the artifact but may still steal a publish token.

Revoke in dependency order

Rotating credentials before understanding trust relationships can lock you out or leave hidden persistence. Typical order:

disable compromised publish token or OIDC trust
freeze registry pushes and environment promotion
rotate registry, cloud, signing, and repository credentials
review workflow permissions and branch protections
remove attacker-created keys, webhooks, runners, and maintainer accounts
then rebuild clean artifacts from verified source

Never assume a key rotation removed attacker persistence. Look for additional publishing identities created during the compromise.

Recovery means trusted rebuilding

A clean rebuild should use known-good source, controlled builder images, refreshed dependency resolution, and independent verification. Compare the new artifact evidence with the suspect artifact evidence. If builds are reproducible, independent rebuild comparison is powerful. If not, use provenance, source review, dependency diffing, and behavioral inspection.

Communicate precisely

Customers do not need vague reassurance. They need artifact identifiers, affected versions, indicators, required action, and evidence that fixed releases are distinct. Internally, record uncertainty explicitly. "No evidence of runtime deployment" is different from "not deployed" if your inventory is incomplete.

Field notes

  • Preserve the package manager cache from affected runners before wiping them; it can prove what was installed.
  • Check mirrors and artifact caches, not only the primary registry.
  • Rotate secrets exposed to build jobs even if the malicious package appears runtime-only; build scripts may have executed.
  • Post-incident controls should favor fewer trusted publishing paths, not twelve new manual approvals.
  • The hardest question is often when the compromise began. Use registry audit history and immutable digests to bound it.

Was this lesson helpful?

Sign in to rate