Problem
Today, when running dart pub get or dart pub upgrade, the resolver may select a version that was published seconds ago on pub.dev.
This increases supply-chain risk. Malicious or compromised packages are often discovered within hours or days after publication. Installing versions immediately after release removes that natural detection window.
Several ecosystems already support a minimum release age policy to mitigate this risk.
Examples from other ecosystems
-
Renovate
{
"minimumReleaseAge": "7 days"
}
-
Dependabot
updates:
- package-ecosystem: npm
cooldown: "7 days"
-
npm-check-updates
Some security platforms such as Snyk even apply a default delay (~21 days) before automatically upgrading dependencies.
The idea is simple: avoid installing versions that are too recent.
Proposed feature
Allow pub to ignore versions newer than a configurable time window.
Example in pubspec.yaml:
dependency_resolution:
minimum_release_age: 7d
Meaning:
Only consider package versions published at least 7 days ago.
Allow exceptions for trusted packages
Projects often maintain their own internal or trusted packages, which should not be delayed. To support this, allow an exception list.
Example:
dependency_resolution:
minimum_release_age: 7d
minimum_release_age_exceptions:
- my_core_lib
- internal_utils
Behavior:
- All dependencies respect the cooldown window.
- Packages listed in
minimum_release_age_exceptions can resolve to the latest version immediately.
This allows teams to safely update their own packages while still protecting against risks from the broader ecosystem.
Example behavior
Available versions:
| Package |
Version |
Publish time |
| foo |
1.3.2 |
20 days ago |
| foo |
1.3.3 |
3 days ago |
| foo |
1.3.4 |
today |
| my_core_lib |
2.1.0 |
today |
With:
dependency_resolution:
minimum_release_age: 7d
minimum_release_age_exceptions:
- my_core_lib
Resolution result:
foo → 1.3.2
my_core_lib → 2.1.0
Possible CLI option
This could also be exposed via CLI:
dart pub get --minimum-release-age=7d
Benefits
- Reduces exposure to malicious or compromised packages
- Provides a simple supply-chain security control
- Maintains flexibility for trusted or internally maintained packages
- Avoids reliance on external tooling
Summary
Adding a minimum package age policy with an exception list would provide a practical security improvement for the Dart ecosystem while preserving fast iteration for trusted packages.
Problem
Today, when running
dart pub getordart pub upgrade, the resolver may select a version that was published seconds ago on pub.dev.This increases supply-chain risk. Malicious or compromised packages are often discovered within hours or days after publication. Installing versions immediately after release removes that natural detection window.
Several ecosystems already support a minimum release age policy to mitigate this risk.
Examples from other ecosystems
Renovate
{ "minimumReleaseAge": "7 days" }Dependabot
npm-check-updates
Some security platforms such as Snyk even apply a default delay (~21 days) before automatically upgrading dependencies.
The idea is simple: avoid installing versions that are too recent.
Proposed feature
Allow
pubto ignore versions newer than a configurable time window.Example in
pubspec.yaml:Meaning:
Allow exceptions for trusted packages
Projects often maintain their own internal or trusted packages, which should not be delayed. To support this, allow an exception list.
Example:
Behavior:
minimum_release_age_exceptionscan resolve to the latest version immediately.This allows teams to safely update their own packages while still protecting against risks from the broader ecosystem.
Example behavior
Available versions:
With:
Resolution result:
Possible CLI option
This could also be exposed via CLI:
Benefits
Summary
Adding a minimum package age policy with an exception list would provide a practical security improvement for the Dart ecosystem while preserving fast iteration for trusted packages.