Skip to content

Don't retry rate-limited attestation lookups - #24433

Merged
p-linnane merged 1 commit into
mainfrom
attestation-rate-limit
Nov 2, 2026
Merged

p-linnane merged 1 commit into
mainfrom
attestation-rate-limit

Conversation

@p-linnane

@p-linnane p-linnane commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

A rate-limited gh attestation verify was classified as an InvalidAttestationError, retried five times with 121s of sleeps per bottle and then reported as a possibly malicious bottle, which wasted CI runner time and described a quota problem as a provenance failure. HTTP 403 and 429 responses carrying GitHub's primary or secondary rate limit wording now raise RateLimitExceededError, which skips the retries and fails the install with a message naming the rate limit. brew verify rescues the new error and reports it per bottle.


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Codex (GPT-6 Astra) wrote the initial change and tests. Claude Code (Fable 5.1) reviewed it against the gh 2.103.3 attestation client, added the secondary rate limit wording and the brew verify rescue, checked that each of its new examples fails without its change and ran brew lgtm on the final commit.


- A rate-limited `gh attestation verify` was classified as an
  `InvalidAttestationError`, retried five times with 121s of sleeps and
  reported as a possibly malicious bottle.
- Raise `RateLimitExceededError` for HTTP 403/429 responses carrying
  GitHub's primary or secondary rate limit wording, skip the retries
  and fail the install with a message naming the rate limit.
- `brew verify` rescues the new error and reports it per bottle.

Signed-off-by: Patrick Linnane <patrick@linnane.io>
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 19030802-7f90-4014-a8f7-5b2496e0f824
Commits

Reviewing files that changed from the base of the PR and between 59604a8 and ece82bf.

Files selected for processing: 5
  • Library/Homebrew/attestation.rb
  • Library/Homebrew/dev-cmd/verify.rb
  • Library/Homebrew/test/attestation_spec.rb
  • Library/Homebrew/test/dev-cmd/verify_spec.rb
  • Library/Homebrew/utils/attestation.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Attestation verification now recognises GitHub API rate limits and reports that installation could not be verified, with guidance to try again later.
    • The verification command now clearly reports a failed result when a GitHub API rate limit prevents verification, rather than treating the issue as another type of attestation error.

Attestation verification now identifies specified GitHub API rate-limit responses as a distinct error. Formula installation reports a retry-later message, while brew verify records verification as failed. Tests cover response classification, no-retry behaviour, installation handling, and command output.

Changes: Attestation rate-limit handling

Layer / File(s) Summary
Classify rate-limit responses
Library/Homebrew/attestation.rb, Library/Homebrew/test/attestation_spec.rb
Defines a distinct error for recognised HTTP 403 or 429 rate-limit responses. Tests distinguish these responses from other errors.
Handle rate limits during formula installation
Library/Homebrew/utils/attestation.rb, Library/Homebrew/test/attestation_spec.rb
Converts the rate-limit error to a formula installation error with a retry-later message. Tests cover the message and no-retry behaviour, including backfill lookup.
Handle rate limits in the verify command
Library/Homebrew/dev-cmd/verify.rb, Library/Homebrew/test/dev-cmd/verify_spec.rb
Adds the rate-limit error to the command’s failure handling. The test checks stderr output and that Homebrew.failed is set to true.
Merge Risk: Minimal · up to ece82

No merge-blocking issue is identified in the supplied evidence.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title states the main change: rate-limited attestation lookups are no longer retried. The raw summary confirms that HTTP 403 and 429 rate-limit responses now raise RateLimitExceededError, which sk…
Description check Passed The description explains the problem and the fix. A rate-limited gh attestation verify was misclassified as InvalidAttestationError and retried five times. HTTP 403 and 429 responses with rate-limit w…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: rate-limited attestation lookups are no longer retried. The raw summary confirms that HTTP 403 and 429 rate-limit responses now raise RateLimitExceededError, which skips retries and fails the install. The title is specific and accurate.

Full details: Description check

Explanation

The description explains the problem and the fix. A rate-limited gh attestation verify was misclassified as InvalidAttestationError and retried five times. HTTP 403 and 429 responses with rate-limit wording now raise RateLimitExceededError, and brew verify rescues the new error. This matches the raw summary and the objectives. The description also lists testing and AI-use disclosures.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@krehel

krehel commented Nov 2, 2026

Copy link
Copy Markdown
Member

Makes sense, thanks!

@p-linnane
p-linnane added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit bf464f5 Nov 2, 2026
56 checks passed
@p-linnane
p-linnane deleted the attestation-rate-limit branch November 2, 2026 02:14

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

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.

3 participants