Skip to content

Add cooldown period to version resolution#250

Merged
wagoodman merged 2 commits intomainfrom
issue-230
Mar 27, 2026
Merged

Add cooldown period to version resolution#250
wagoodman merged 2 commits intomainfrom
issue-230

Conversation

@wagoodman
Copy link
Copy Markdown
Contributor

@wagoodman wagoodman commented Mar 25, 2026

Add a configurable release cooldown feature to protect against supply chain attacks. This implements a time-based buffer between when a tool version is published upstream and when binny will install it, giving time for malicious releases to be detected and pulled.

Closes #230

Changes

  • Add global cooldown configuration option (e.g., cooldown: 7d) that applies to all tools
  • Add per-tool version.cooldown override to customize or disable cooldown for specific tools
  • Add --ignore-cooldown CLI flag for install and update commands to bypass the check when needed
  • Implement cooldown enforcement in github-release and go-proxy version resolvers
  • Add CooldownError type with helpful error messages showing version age, cooldown duration, and time remaining
  • Support human-friendly duration parsing (e.g., 7d, 3d, 168h)

How It Works

When resolving the latest version, the resolvers now check the publish date of each candidate release:

  • github-release: Uses the GitHub releases API to fetch publish timestamps
  • go-proxy: Fetches version info from proxy.golang.org/@v/{version}.info endpoint
  • git: Does not support cooldown (logs a warning if configured)

If no version satisfies the cooldown period, a CooldownError is returned with actionable information about when the user can try again.

Configuration Examples

# Global cooldown for all tools
cooldown: 7d
tools:
  - name: gh
    version:
      want: latest
# Per-tool override
cooldown: 7d
tools:
  - name: gh
    version:
      want: latest
      cooldown: 3d  # shorter cooldown for this tool
  - name: critical-tool
    version:
      want: latest
      cooldown: 0   # disable cooldown for this tool

@wagoodman wagoodman changed the title fix(cooldown): address code review findings Add cooldown period to version resolution Mar 25, 2026
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman requested a review from a team March 25, 2026 15:32
Comment thread README.md
| `name` | The name of the tool to install. This is used to determine the installation directory and the name of the binary. |
| `version.want` | The version of the tool to install. This can be a specific version, or a version range. |
| `version.constraint` | A constraint on the version of the tool to install. This is used to determine the latest version of the tool to update to. |
| `version.cooldown` (optional) | A per-tool cooldown duration that overrides the global `cooldown` value (e.g. `3d`, `0` to disable). Only applies when resolving the latest version during `install` or `update`. Not supported by the `git` version resolver. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason the git resolver doesn't support this? I'd think it could, acknowledging commit times can be forged, but they shouldn't be able to be forged in all cases, such as using squash commits in GitHub.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it and also was looking at commit times, but it didn't seem practical on a first pass from a security perspective. (We can always add this later)

Comment thread cooldown_error_test.go Outdated
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman enabled auto-merge (squash) March 27, 2026 12:42
@wagoodman wagoodman merged commit dc42515 into main Mar 27, 2026
4 checks passed
@wagoodman wagoodman deleted the issue-230 branch March 27, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement configuration for release cooldown period

2 participants