audit: require curl dependencies to have a working HTTP mirror#22898
Open
p-linnane wants to merge 1 commit into
Open
audit: require curl dependencies to have a working HTTP mirror#22898p-linnane wants to merge 1 commit into
p-linnane wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens brew audit for curl dependencies by adding an online check that verifies at least one http:// mirror actually serves the expected bytes (matching the formula’s checksum) over plain HTTP, preventing broken mirrors from silently passing audit.
Changes:
- Add
ResourceAuditor#audit_curl_dep_http_mirrorto verify an HTTP mirror is reachable and matches the expected checksum (stable specs only, online audit). - Refactor curl-dependency detection into a shared
curl_dep?helper. - Add
formula_auditor_speccoverage for working, unreachable, wrong-checksum, and HTTPS-redirecting HTTP mirrors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Library/Homebrew/resource_auditor.rb | Adds the new curl-dependency HTTP mirror audit and refactors curl-dependency detection. |
| Library/Homebrew/test/formula_auditor_spec.rb | Adds specs exercising the new audit behavior for curl dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Patrick Linnane <patrick@linnane.io>
79c2002 to
ae6d3e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brew auditalready checks thatcurldependencies list an HTTP mirror, since they can be fetched beforeca-certificatesis available and so need a source archive reachable over plain HTTP. It never checks that the mirror actually works, though, so a silently broken HTTP mirror still passes. Spotted by @cho-m after a recentlibpslupdate whose HTTP mirror (MacPorts) started 404ing while the audit stayed green.This adds an online
ResourceAuditor#audit_curl_dep_http_mirror, run only for stable specs ofcurldependencies. It fetches eachhttp://mirror with--proto-redir =httpso that an HTTPS redirect fails rather than masking a non-functional plain-HTTP path, then confirms the bytes match the resource checksum, reporting a problem only when no HTTP mirror works. It generalises the manual checksum check thexzformula currently performs in itstestblock.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Drafted with Claude Code (Opus 4.8). I verified with
brew lgtmand by confirming the new specs fail against the disabled check and pass with it.