Full Byte Developer.

Make npm, pnpm, Yarn and Dependabot wait for new releases

A release-age gate delays installation of packages published in the last day.

Published here , updated · 5 sources

A package published an hour ago can already be in your lockfile if installs chase latest. A release-age gate skips versions younger than a window you set, so a malicious publish can be yanked before your next resolve [1][2][4][5]. Set the same idea in npm, pnpm, Yarn, and Dependabot.

One minute: pick a window and write it down

Start with one day for developer installs and three days for automated version bumps. Those numbers match common defaults: pnpm 11 defaults minimumReleaseAge to 1440 minutes, and Dependabot defaults version-update cooldown to three days [2][3][5]. Write the policy in the repo so every laptop and CI job share it.

text
Developer installs: wait ~1 day after publish
Dependabot version bumps: wait 3 days (default)
Security updates: no cooldown (Dependabot still ships them)

The gate is not a malware scanner. It only refuses versions whose registry publish time is too recent. A five-day-old malicious package still installs.

npm: min-release-age in days

npm's config key is min-release-age. The value is a number of days. When set, npm builds the tree so only versions older than that window install [1]. Put it in the project .npmrc:

ini
min-release-age=1

Exclude packages you own and publish often:

ini
min-release-age=1
min-release-age-exclude[]=@myorg/*

Per the docs, when the window blocks a fix that npm audit fix would install, npm keeps the vulnerable version, warns, and exits non-zero. Add the package to min-release-age-exclude, or relax the window, when you need that fix immediately [1].

This agent environment ran npm 10.9.9. Setting the option there failed:

text
npm error `min-release-age` is not a valid npm option

Use an npm CLI that documents min-release-age (npm docs under the v11 config pages) before you rely on the gate in CI [1]. Check with:

bash
npm --version
npm config get min-release-age

pnpm: minimumReleaseAge in minutes

pnpm measures the window in minutes. Since pnpm 11, minimumReleaseAge defaults to 1440 (one day) and supply-chain defaults flipped safer [2][3]. Put the setting in pnpm-workspace.yaml, not as a casual .npmrc knob: pnpm 11 reads non-auth settings from YAML [3].

yaml
minimumReleaseAge: 1440
minimumReleaseAgeExclude:
  - '@myorg/*'

minimumReleaseAgeExclude lists package names (or patterns) that may install immediately [2]. minimumReleaseAgeStrict controls whether resolve fails when no mature version matches the range; when you set minimumReleaseAge yourself, strict mode defaults on [2].

This environment had pnpm 10.33.4, where pnpm config get minimum-release-age printed undefined. Upgrade before you treat the one-day default as present.

Yarn Berry: npmMinimalAgeGate as a duration

Yarn documents npmMinimalAgeGate as a minimum age according to the npm registry publish date. Versions newer than the gate are not considered for installation [4]. The docs show a duration string:

yaml
# .yarnrc.yml
npmMinimalAgeGate: "1d"

npmPreapprovedPackages lists descriptors or name globs excluded from package gates [4]. On Yarn 4.10.3 in this environment, with no gate set, yarn config get npmMinimalAgeGate printed 0. After writing npmMinimalAgeGate: "1d" into .yarnrc.yml, the same command printed 1.

Classic Yarn 1.x does not carry this Berry setting. Confirm yarn --version starts with 2+ (Berry) before you copy the YAML.

Dependabot: cooldown for version updates only

In .github/dependabot.yml, the cooldown block delays version updates. GitHub applies a default cooldown of three days to version updates even when cooldown is omitted. That default does not apply to security updates [5].

yaml
version: 2
updates:
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "weekly"
    cooldown:
      default-days: 3
      exclude:
        - "@myorg/*"

You can split major, minor, and patch waits with semver-major-days, semver-minor-days, and semver-patch-days where the ecosystem supports SemVer [5]. The exclude list wins over include: a name on both lists updates immediately [5].

Warning: Do not read a quiet Dependabot week as "npm is safe." Security PRs can still open the same day a patched release lands, by design [5].

release-age gate t=0 publish registry latest age window skip young versions install / Dependabot mature version only npm min-release-age (days) · pnpm minimumReleaseAge (minutes) Yarn npmMinimalAgeGate (duration) · Dependabot cooldown default-days Dependabot security updates skip cooldown [5]

Age gates delay ordinary installs and version bumps; Dependabot security updates still move immediately.

Lockfiles still decide what you ship

The age gate runs when the client resolves or installs. If package-lock.json, pnpm-lock.yaml, or yarn.lock already pins a bad version, a cold install of that lockfile still gets the bad pin. Commit the lockfile. In CI use deterministic installs:

bash
npm ci
pnpm install --frozen-lockfile
yarn install --immutable

After an incident, delete the bad pin from the lockfile (or regenerate after excluding the version), then let the age gate prevent racing the next compromise. For how a worm reused stolen publish credentials across packages, see How the September 2025 npm worm spread.

Mistakes that leave the gate open

Putting minimumReleaseAge only in .npmrc on a pnpm 11+ repo that expects YAML settings, then assuming the default still protects you [3].

Using Yarn classic while copying Berry .yarnrc.yml keys. The gate never loads.

Setting Dependabot cooldown and then wondering why security PRs still open the same day. Version updates wait; security updates do not [5].

Chasing floating ranges in apps without a lockfile. The gate helps, but every machine can still resolve a different mature version unless you pin.

Running npm 10 in CI while the docs and laptop use npm 11 with min-release-age. The option is rejected and installs proceed without the window.

Rollout that does not block the whole company

  1. Enable Dependabot cooldown (or accept the three-day default) on version updates [5].
  2. Set a one-day window in the package manager your apps actually use.
  3. Exclude internal scopes you publish several times a day.
  4. Document how to break glass for an urgent patched release (min-release-age-exclude, minimumReleaseAgeExclude, or a temporary shorter window).

Watch the first week of CI. Failures that say no version satisfies the range usually mean every candidate is still inside the window. Either wait, widen the range to an older line, or exclude that one package on purpose.

How the window interacts with ranges

A caret range such as ^1.4.0 can still resolve to many versions. The age gate removes the young ones from consideration, then the usual semver solver picks among what remains [1][2]. If every version that satisfies the range is still inside the window, resolve fails (or, for pnpm in non-strict mode, may fall back depending on minimumReleaseAgeStrict) [2]. That failure is the gate working. Widen the range only when you deliberately accept an older line, not by clearing the window in panic.

Exact pins (1.4.2) and lockfile entries still install that exact version even if it would be too young to newly resolve today. Treat lockfile review after an incident as mandatory. The age gate protects the next resolve, not the pin you already shipped to production last night.

Transitive dependencies count. A direct dependency can be months old while one of its nested deps published malware an hour ago. pnpm documents that minimumReleaseAge applies to all dependencies including transitive ones [2]. npm's tree build with min-release-age similarly constrains installable versions across the tree [1]. Do not assume "we only depend on three packages" means three publish clocks.

Local overrides without abandoning the repo policy

Sometimes you need a one-off install of a package published twenty minutes ago (your own canary, a partner's hotfix). Prefer a documented exclude for that package name over deleting the project-wide window. npm's min-release-age-exclude, pnpm's minimumReleaseAgeExclude, Yarn's npmPreapprovedPackages, and Dependabot's cooldown.exclude exist for that [1][2][4][5]. Put the exclude in the PR description so the next reader knows it was intentional.

CLI flags and environment overrides can relax a lower-priority config. Know your tool's precedence so a laptop export does not silently disable the gate while CI still enforces it. For npm, before can coexist with min-release-age; when both apply in one source, before wins [1]. Use absolute cutoffs for forensic rebuilds of an old tree; use relative age for day-to-day defense.

What cooldown does not cover

Git dependencies and local path packages are outside the "registry publish time" story. A malicious commit on a git URL can be brand new while still installing. Exotic protocols need separate policy (pnpm's supply-chain docs discuss related defaults such as blocking exotic subdeps in v11) [3].

Private registries that omit publish time metadata may skip or fail the age check depending on tool settings. pnpm's minimumReleaseAgeIgnoreMissingTime defaults to skipping the check when time is missing; set it false if you want hard failure instead [2]. Know what your mirror stores before you celebrate the YAML.

Cooldown also does not replace refusing typosquat names, reviewing lifecycle scripts, or requiring provenance where you publish. It is one delay valve in a longer supply-chain checklist.

A cooldown buys hours while registries and researchers react. It does not replace pin review, provenance checks, or refusing fake package names. Pair it with a lockfile and a human glance at sudden major bumps.

Pair the age gate with the pack trap in .npmignore can publish the .env your .gitignore was hiding. Browse the Dev tools topic.

Send this to the friend who installs every npm release the same hour it lands.

Fresh package cubes arriving on a short conveyor and held in a glowing amber waiting bay while a time-ring around the bay completes a rotation, after which a cube may enter the install hopper, shown as unmarked geometric solids with no typography or logos.
A release-age gate delays brand-new packages before they can be installed.

Keep this guide

By Full Byte Developer

Filed under Dev tools, Security

Questions about this guide

Why wait about a day?

Compromised releases are often flagged and removed from the registry within hours. A cooldown filters most of those incidents at the install layer.

Does Dependabot wait by default?

Yes. Dependabot applies a default cooldown of three days for version updates even when cooldown is not configured. Security updates bypass the cooldown.

Does a cooldown fix a bad lockfile pin?

No. The gate runs at resolve or install time for new versions. A lockfile that already pins a bad release still installs that pin.

Sources

Next in this stack