Cargo and NuGet Both Learned to Wait
Two package ecosystems I use every week shipped the same safety feature in the same week. It's a small setting, and one of the most sensible things to happen to dependency management in a while.
Here's the idea. When someone slips a malicious version of a package into a registry, it usually gets caught fast, often within hours, by automated scanners or by the community. The npm attack in September 2025 is the textbook case: compromised versions of chalk, debug and other packages with billions of weekly downloads were live for a few hours before they were pulled. If your tooling had simply refused to use any version less than a few days old, it would never have picked them up.
That's a dependency cooldown. The JavaScript world got them first (pnpm's minimumReleaseAge, for example). This month, Rust and .NET got them too, in the same week.
Cargo (Rust 1.100)
Add this to .cargo/config.toml:
[registry]
global-min-publish-age = "3 days"
From then on, when Cargo chooses versions, it skips anything published more recently than that, and tells you what it held back:
$ cargo update
Locking 2 packages to highest compatible version as of min-publish-age
Adding cc v1.11.0 (available: v1.18.0, published 3 hours ago)
When you need a new version right away, say for a security fix, you can override it for a single update:
CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE=allow cargo update clap --precise 4.6.9
Two caveats from the release notes: cargo install ignores the setting, and versions without a publish time in the registry index are never held back.
NuGet (.NET 11 SDK)
On the .NET side the setting is per package source, minPublishAgeHours in nuget.config, and the CLI can set it:
dotnet nuget update source nuget.org --min-publish-age-hours 72
dotnet package add and dotnet package update respect it when they pick a version, and asking for an explicit version bypasses it. You can also exempt packages by name pattern, which is handy for your company's own internal packages.
The interesting difference
Both tools only apply the cooldown when a version is being chosen. Versions already pinned in Cargo.lock or your project files are left alone, which is fine: the risky moment is the update, not the rebuild.
Where they differ is transitive dependencies, the packages your packages depend on. When Cargo resolves, it picks the newest compatible version of everything, so the cooldown matters for the whole tree. NuGet restore doesn't apply the age to transitive dependencies at all, but NuGet has always resolved them to the lowest version that satisfies the requirement, so a version published an hour ago rarely gets pulled in by accident in the first place. The two ecosystems made different choices years ago, and the cooldowns fit each of them.
What I'm doing
- Rust:
global-min-publish-age = "3 days"goes in~/.cargo/config.toml, so it applies to every project on my machine, including this site. - .NET at work:
minPublishAgeHoursof 72 on nuget.org in our sharednuget.config, with an exception for our internal packages. - Security fixes: I'll keep taking them immediately, deliberately, with the explicit override. That's the right way round: the default is cautious, and the exception is a decision someone made.
One honest caveat: cooldowns work because someone else finds the problem during those days. If everyone waited, the early warning would have to come entirely from the automated scanners, and that's mostly where it comes from already. So this isn't a complete defense. You still have to look at what you're upgrading. But it removes a whole class of "it was only live for two hours, and we happened to build in those two hours" accidents, at the cost of one line of configuration. That's a good trade.
More on this month's Rust and .NET releases in my story Rust 1.100, .NET 11 and a Busy November.
Sources: Announcing Rust 1.100.0, What's new in the .NET 11 SDK.
Comments
Log in to leave a comment.