-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
Proposal Details
Background
Supply chain attacks on open-source software dependencies have become a regular occurrence. Go already takes measures against supply chain attacks. While Go libraries aren't a common target, this year GitLab detected one attack that involved typosquatting.
The idea of a "dependency cooldown" is to not download dependencies that are too new. The theory behind it is that most supply chain attacks in their active phase are detected quickly, so they are possible to avoid by waiting. The blog post "We should all be using dependency cooldowns" presents empirical evidence in favor of this based on recent (non-Go) attacks.
Proposal
When a cooldown is configured, commands like go get and go mod tidy would only consider dependency versions that are at least N days, weeks, or months old.
This could be controlled with an environment variable:
GOCOOLDOWN=15d go mod tidy
With this setting, Go would skip any dependency versions published less than 15 days ago when resolving dependencies.
Alternatives
The primary alternative is to use external tools like Dependabot that already support this.
Open questions
The design naturally invites questions about scope:
- Should this apply to all dependencies equally?
- Should the cooldown interval be set in the development environment or in
go.mod?