Security model
On this page
cooldown is a supply-chain control, so it is worth being precise about what it defends, what it doesn’t, and the properties that make the defense hold.
Threat model#
The target is the smash-and-grab window: a malicious version is published to a registry and is detected and yanked within hours to a few days. A cooldown delays adoption until that window has passed, so the community’s tooling and reports run before the code reaches your builds.
It is not a malware scanner — it never inspects code — and it does not replace the tools that do a different job. It pairs with govulncheck, cargo audit, and advisory feeds, which catch known vulnerabilities and published advisories rather than not-yet-known malicious releases. The optional advisory feed closes the seam between the two: it flags (or fast-tracks) versions that fix a published advisory, but it never turns check into a vulnerability gate — a vulnerable pin is those tools’ finding, not a cooldown violation.
The risk surface is the resolved graph#
What you declare is not what you ship — the resolved lockfile is. A single ^1.4 pulls in transitive dependencies, and a re-lock can silently advance any of them to a brand-new version. So check evaluates direct and transitive dependencies by default, and a floor applies to transitives too.
For a too-fresh transitive you genuinely can’t act on — one the graph pins, or one you’d rather not block CI on — the gate can be relaxed, but only deliberately:
check --transitive allow— keep it visible but non-fatal.check --transitive hide— a direct-only gate.
The strict, whole-graph default stays opt-out, never opt-in.
Mutations honor the selected graph gate#
For Cargo, upgrade and fix evaluate resolver changes in an isolated project. If a re-lock leaves
a new too-fresh, non-acknowledged dependency in the graph, the trial rejects that change before
anything becomes visible in the source. The complete accepted manifest-and-lock state is published
under one project-visible recovery record whose exact digest is anchored in cooldown’s
owner-private coordination namespace beneath Git’s common directory on Unix. Recovery revalidates
the complete expected project state and the exact marker and authority identities immediately
before consuming that evidence. On Unix, a Cargo source mutation that reaches this path without
anchored authority — outside a Git worktree — fails closed, because untrusted bytes cannot authorize
restoration.
The other ecosystems resolve in one of two ways:
- In a scratch copy: Yarn (Berry and Classic), Hex, Maven, Gradle and pixi resolve in a scratch copy of the project and write back only the lock, or the POMs for Maven.
- In place: the other ecosystems currently run resolver trials in place under the project lease.
cooldownrecords the files each trial may change, rolls a rejected trial back only when those files still match the observed resolver output, and stops if independent drift makes restoration unsafe.
These ecosystems do not yet use Cargo’s persistent whole-project recovery record.
Cargo selects that same in-place path on platforms where cooldown cannot prove the coordination
namespace is private to the current user — Unix ownership bits today, so Windows always. Those runs
keep the rollback guarantees of the in-place path above but have no persistent recovery record, so an
interrupted mutation is repaired by hand rather than by cooldown recover. A project that does
carry recovery artifacts still refuses to consume them without authority there: the fallback
removes the ability to publish evidence, never the requirement to authenticate it.
Every mutation that reports success has passed the package manager’s verification and the selected cooldown transitive policy:
- The default whole-graph policy: leaves the graph gate-clean by construction.
--transitive allow: deliberately retains visible fresh transitives.--transitive hide: excludes transitives from the gate.
cooldown coordinates access through target-derived lock files, kept in one of two places:
- Git repositories: Git’s common directory.
- A non-Git project:
.cooldown/locks, including for read commands, so add.cooldown/to that project’s ignore rules if it is not already ignored. These non-Git lock files coordinate cooperatingcooldownprocesses but do not authorize recovery.
Each project lock is held per manifest family (Cargo.toml, package.json, pyproject.toml, …), so tools that rewrite different manifests at one directory never wait on each other, while tools that share one (uv and poetry, the npm family) do.
Every tool installs into the same node_modules or .venv in a directory, so three operations additionally hold a lock on the directory’s build environment:
- a
--buildstep - an upgrade whose native command installs as it pins
outdated’s preview of an adoptable update, which runs that command on a copy
The lock file is named for the directory and the family, so a cooldown from before the per-family locks does not see a newer cooldown’s locks, nor the reverse. Do not run the two side by side in one repository.
Cache hardening#
Publish times are cached, and the cache is treated as adversarial input:
- A cached publish time may never move earlier on refresh — it is a monotonic floor.
- A backdated upstream timestamp (a release claiming to be older than what was already recorded) is rejected, not trusted.
This closes the obvious bypass — an attacker backdating a release so it appears to have already cleared the window.
Two flags control how the cache is used at the boundary:
--offline: turns every cache miss intounknown-age(never a false “ok”).--fresh: ignores the cache entirely and re-fetches — the right choice for a CI gate that must not pass on stale data.
The advisory feed inverts the rule, because it is a loosening input where publish times are a tightening one: stale cached advisory data may still annotate a row, but it never shortens a window — the shorten mode degrades to annotate-only, with a warning. An unreachable feed likewise fails open (the ordinary, stricter window stands) where a registry outage fails closed.
Escape hatches are explicit and audited#
Loosening the policy is always deliberate and always visible:
- Exemptions (
--latest,--allow, configallow) are audited — every one shows up incooldown explain. - A
floorbounds config-level loosening: it is max-clamped across layers, so a more specific block can’t quietly weaken it, and anallowcan only bypass it when co-declared with it, or through the audited--allowflag orCOOLDOWN_ALLOWvariable.--latestdoes not bypass a floor. - The advisory security window is bounded the same way: a
floorclamps it unlessbypass-flooris declared in the floor’s own layer, so the worst a poisoned feed can do is drop a window to the floor.
There is no silent path to “adopt anything” — every one leaves a trail.
Reporting a vulnerability#
For a security issue in cooldown itself, please use GitHub’s private vulnerability reporting on the repository rather than a public issue.