Incidents and threats
An incident means something may already have reached your machines. Pratique opens one when a package you pulled turns bad, or when a file doesn't match what was published, and names who is affected.
What opens an incident
Most problems never become incidents, because Pratique refuses the release before a client gets it. An incident opens when Pratique can't rule out that something bad already reached you, or when it finds that a registry or a build changed something it shouldn't have. Each incident has one of these titles:
| Title | When it opens |
|---|---|
| Reported as malware after it was pulled | A version a client already received is now reported as malware, by OSV or by one of your custom feeds. |
| A project or build uses a package reported as malware | A project's lockfile, or a recent build record, lists a version reported as malware. |
| A published file changed upstream | The registry now declares a different hash for a file than the one Pratique pinned. It also opens when a removed file comes back different, and when a Composer release's tag moves to a different Git commit. |
| A download didn't match its declared hash | A file Pratique downloaded doesn't match the hash the registry declares for it. |
| A new release claims to be older than it is | A release appears with a date older than a listing that didn't include it. Its quarantine clock starts when Pratique first sees it instead. |
| The Go checksum database failed a check | The Go checksum database failed a consistency check. |
| A stored file isn't the one its build made | A build record says it made an artifact, and the file stored under that version is different. |
| A file doesn't match what the registry lists | An npm file clients pulled has an install script or a dependency that the registry's listing hides. See Manifest mismatch. |
| A release's build provenance doesn't verify | A release's signed build record fails to verify, or doesn't cover its file. See Provenance. |
| A release was built from an unexpected repository | A verified release was built from a different repository than the release before it, or than the one you required. |
Provenance incidents only open while at least one of the two provenance rules is on, because Pratique doesn't check provenance otherwise. A manifest mismatch opens an incident whatever the rule is set to.
How Pratique finds out late
A package can be reported as malware long after it cleared quarantine. Two jobs keep watch:
- The change feed. Every 5 minutes, Pratique reads OSV's list of new and changed reports, so a new report reaches stored packages within minutes.
- The hourly recheck. Every hour, Pratique asks OSV again about every package it has stored, every package a project's lockfile lists, and every package a build from the last 90 days used. Private names are never sent.
A custom feed that newly lists a package someone already pulled also triggers a recheck of that package. See Threat feeds.
Read an incident
Open Incidents from the sidebar. A badge on it counts the open incidents. Open incidents come first, newest first, then resolved ones. Each incident card shows:
- The title, the package and version, the registry, and when it opened.
- A detail line, such as the report's ID or the two hashes that differ.
- What the reports say: each threat report for the version, with its source.
- Projects that use this version: each project whose lockfile lists it, and when the lockfile was reported.
- Builds that made or used this version: each build record, and whether it made or used it.
- Who pulled this version: each person or bot that downloaded it through Pratique, the addresses they downloaded from, the number of downloads, and the most recent one.
If nobody downloaded the version, the card says so. If no project or build lists it, the card says that too, as a reminder that only projects that report are covered. See CI to report them.
Three buttons help you act:
- Open the version opens its explanation on the package page.
- Every event for it opens Activity for that version.
- Block the package opens the package's exceptions. Admins only.
Respond to an incident
Further downloads of a version reported as malware are already refused. The incident is about the copies that got out before.
Find who has it
Read Who pulled this version, Projects that use this version and Builds that made or used this version. The addresses name the machine when a client had no token.
Check those machines
Check each machine and build that has the version. Rotate any credentials they hold if the package ran there.
Stop it spreading
For a package you no longer trust at all, select Block the package. Stopping a version doesn't remove copies clients already have.
Resolve the incident
An admin enters What was done, which is optional and up to 1,000 characters, and selects Mark as resolved. The card then shows who resolved it and the note.
A resolved incident stays resolved when Pratique sees the same thing again. If something new is found about the same version, such as a different report or a different hash, the incident opens again.
Alerts
Set PRATIQUE_WEBHOOK_URL, or server.webhook_url in the config file, to send each new
incident to a chat channel or another endpoint. The message names the incident, the package and version, and links to
Incidents. Slack incoming webhooks work as they are.
Delivery is retried three times from memory, so an alert can be lost if the server restarts during an outage. The
incident itself is always stored, so check Incidents after any downtime. To alert on
open incidents from your monitoring, use the pratique_incidents_open metric. See
Monitoring.
Threats stopped
Threats stopped shows what Pratique kept out that turned out to be malicious. It lists releases from the last 90 days that Pratique held or refused, that are reported as malware, and that no client ever downloaded. A version that a client downloaded isn't counted as stopped. It shows under Reached clients instead, and its incident is on the Incidents page.
Summary
Four numbers sit at the top:
- Malicious releases kept out: the releases in the list.
- Blocked before the report: those Pratique blocked before the report was published.
- Requested by a client: those a client asked for as a file.
- Reached clients: a link to the incidents for reported versions that clients did download.
If some blocked releases couldn't be checked for reports, a note says how many, and that they aren't counted. Check that OSV is reachable.
Attack timeline
Each row is one release. The columns are:
- Report: the report's ID, with a link to OSV where it has one, and its summary.
- Stopped by: what blocked the release first, such as Quarantine, Known malware or a risk rule.
- Client: Requested the file if a client asked for it, or Hidden from a listing if a client was only shown a listing that marked it as not installable.
- First blocked and Reported: when Pratique first blocked it, and when the report was published.
- Margin: how long before OSV published its report that Pratique first blocked the release. It uses OSV's date, not when Pratique learned of the report. It shows Already reported if the report came first.
A listing records only its newest hidden version, so the page can undercount.
Who was protected and which quarantine would have caught them
Who was protected ranks the clients whose requests were blocked.
Which quarantine would have caught them shows, for windows of 1, 3, 7, 14 and 30 days, how many releases would still have been held when their report came out. Use it to judge whether your window is long enough. It only counts releases with a known release date and report date. Registries often remove the date along with a malicious release.
If nothing blocked in the last 90 days has been reported, the page says so. That isn't proof the releases were safe, because reports can arrive later.