Safeguard
Security Guides•

What security evidence expires, and what should you save first?

Some evidence about a security incident disappears fast: pages change, version counts roll off, notifications age out. What to save in the first hour.

Safeguard Security Team
6 min read

Several kinds of evidence expire on their own: web pages get edited, npm per version download counts cover only seven days, GitHub inbox notifications last three months unless saved, and caches get purged. In the first hour of a security story, save these before you start the analysis.

Why the first hour

Analysis can be redone. Evidence that has rolled off cannot. A short, boring save step at the start costs minutes and protects your ability to explain what you knew later.

The list

EvidenceWhy it expiresHow to save it
The source write-upAuthors edit or remove pagesArchive plus a PDF print, see archiving a write-up
Per version npm downloadsThe per version API only covers the previous 7 daysQuery it and store the JSON
Daily npm downloadsData lands after UTC midnight and queries are limited by rangePull the range for the window and store it
GitHub notificationsThe inbox keeps them for 3 months unless marked SavedCopy key items into the ticket or mark them Saved
Registry metadataVersions can be removed or editedSave the JSON for the package
CI logsRetention is often shortExport the runs inside the window
Build caches and mirrorsPurged during cleanupNote what they held before purging

The seven day and three month figures come from the npm and GitHub documentation listed below. Check your own CI and logging retention settings, since those vary by setup.

Commands worth running right away

# registry facts for an npm package
npm view some-package versions --json > versions.json
npm view some-package time --json > time.json

# per version downloads, last 7 days only
curl -s https://api.npmjs.org/versions/some-package/last-week > versions-last-week.json

# PyPI project record
curl -s https://pypi.org/pypi/some-project/json > pypi-record.json

Store the files in the incident ticket with the date and time in UTC. They are small.

Save before you clean up

The most common mistake is cleaning first. Purging a cache, deleting a build or rolling back a lockfile feels responsible, and it also removes the proof of what was installed. Record what exists, then clean. The same goes for rebuilding a machine: capture the lockfile, the installed package list and the relevant logs first. See the post on preserving evidence before cleaning up.

Keep a short evidence index

In the ticket, keep a list: what it is, where it is stored, when you captured it and who captured it. A reviewer can then see in one place what you had at each point.

A worked example

Imagine that at 07:40 UTC a notice says two versions of an npm package were published by an attacker. You decide to run the save step before any analysis.

The routine takes about ten minutes.

  1. Page. You archive the notice, print it to PDF and paste the key sentence into the ticket, all stamped 07:41 UTC.
  2. Registry. You run the registry commands and save the versions and time data, 07:44 UTC.
  3. Downloads. You run the per version query for the last week. The bad version appears with its counts. You save the JSON, 07:46 UTC. Next week this query would no longer return that version's numbers.
  4. Notifications. You mark the two security alert notifications in your GitHub inbox as Saved, 07:48 UTC.
  5. CI. You export the logs of the last 20 builds of the two services and save them to the incident folder, 07:52 UTC. Your CI keeps logs for 30 days, so these would survive for now, but you export anyway.
  6. Index. You add a six line evidence index to the ticket: what, where, when, who.

Only then do you start your actual analysis. If you find nothing, the folder shows exactly what you looked at. If you find something, nothing that matters has disappeared.

How long does each thing last

Retention is the whole question, so write it down once for your own systems.

SourceTypical retention questionWhere to check
npm per version downloads7 days, per the npm documentationFixed by the registry
GitHub inbox3 months unless saved, per GitHub docsFixed unless you save
CI logsSet by your CI configurationYour CI settings
Application and proxy logsSet by your logging setupYour logging settings
Mirror and cache contentsSet by your cleanup policyYour registry or mirror settings
Web archive copiesPersist, but only if the save workedOpen the archive link to verify

The first two rows come from documentation. The rest depend on how you configured things, so look them up before an incident rather than during one.

What to do about short retention

If you discover that your CI or proxy logs expire quickly, you have two options. Lengthen the retention for the logs that matter, or add an export step to your incident routine. The cost of keeping build logs for longer is usually small compared with the cost of being unable to say whether a build ran during a bad window.

Make that decision on a quiet day. Under pressure, nobody wants to review retention settings.

Make the save step automatic

The more of this you can script, the less it depends on memory. A small script that takes a package name, runs the registry queries, downloads the JSON records and writes them into a dated folder turns a ten minute chore into thirty seconds. Keep the script in your incident repository next to the runbook.

Remember that saving is not analysis. It is insurance. You will often discard everything you saved, and that is a good outcome.

Try it yourself

Click through it at your own pace, or open it full screen. Look at how a project is watched over time, since a dependency can change status after you last checked.

Quick check

How long do npm per version download counts last?

The npm documentation says per version counts are only available for the previous 7 days.

Should I save evidence even if I think we are not affected?

Yes, it is cheap. It lets you show later why you reached that conclusion.

Is exporting CI logs worth it if they are kept for 30 days?

Often yes. Incidents sometimes surface late, and an export costs seconds. Check your own retention settings before relying on defaults.

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.