Safeguard
Security Guides•

What evidence should you save before cleaning up a supply chain incident?

Save logs, lockfiles, artifacts and audit exports before you delete or rebuild anything. Here is the short list, and why the order of work matters.

Safeguard Security Team
3 min read

Before you clean up a supply chain incident, save five things: CI and build logs, the lockfiles and manifests at the affected commits, the suspect artifacts and image digests, audit log exports, and a copy of the malicious package itself. Cleanup destroys evidence, and logs expire on their own schedule.

Why save first

Cleaning is satisfying and urgent, but a deleted cache, a rotated token or a rebuilt image removes the facts you need to scope the incident, answer customers and learn from it. NIST SP 800-61 Rev. 3, published in April 2025, frames incident response as part of cybersecurity risk management, with detection, response and recovery activities. Preserving what you found is part of doing recovery well.

What to save

EvidenceWhyWatch for
Build and CI logsShow what ran and whenRetention limits
Lockfiles and manifests at affected commitsShow what would installBranch deletion
Suspect artifacts and image digestsShow what shippedRegistry cleanup rules
Audit log exportsShow who did whatGitHub shows 180 days of audit events
The malicious package filesSupport analysis and reportsRegistry removal
Network and DNS logsShow outbound callsShort default retention

GitHub's organization audit log covers the last 180 days and can be exported as JSON or CSV, with limits on export size, so narrow your filters first.

Steps

  1. Name an evidence owner so exactly one person is saving things.
  2. Export audit logs for the window, with a margin before and after.
  3. Copy CI logs and run metadata for every job that touched the package.
  4. Download the malicious package tarball from your proxy or cache if still present, and store it read only, away from build systems. Never run it.
  5. Note the digest of each suspect image rather than only tags.
  6. Hash each saved file and record who saved it and when. This is a light chain of custody, enough for a later review.
  7. Only then start cleanup.

Do not delay containment

If an active attacker is using a credential, revoke it now and capture what you can in parallel. Evidence matters, but not at the price of ongoing damage. See investigating a CI/CD compromise.

Where to keep it

Store evidence in a restricted location that the compromised systems cannot write to, ideally in an account separate from the affected build tooling. Limit access to the incident team. Keep a simple index listing each item, its hash, its source system, the time it was captured and who captured it. Decide a retention period with legal, since some evidence may be needed later for contract or regulatory questions, and some may contain personal data that should not be kept forever.

Quick check

Do I need forensic grade chain of custody?

Usually a lightweight record of who saved what, when, with hashes, is enough. If legal action is likely, ask counsel early.

Is it safe to keep the malicious package?

Yes if stored as an inert file in restricted storage and never installed or executed.

Safeguard can record SBOMs and scan results over time, which helps show what a build contained. You can try a free scan at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.