vulns/scanner: fall back to verbatim head URL for non-forge repos#23103
Merged
Conversation
repo_url only normalises GitHub, GitLab and Codeberg, so formulae whose stable, head and homepage URLs are all hosted elsewhere (bash, gmp, gnu-tar, go, make, openconnect, zsh) were skipped outright. Restore the tap's last-resort fallback: query OSV with the source URL verbatim when its path yielded a tag, otherwise the head URL verbatim. OSV's GIT ecosystem returns nothing for these hosts today, so this is parity with the tap and future-proofing rather than a detection change. Follow-up to Homebrew#23080.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts Homebrew::Vulns::Scanner target derivation so formulae hosted on non-supported forges (anything outside GitHub/GitLab/Codeberg) are no longer skipped outright, by falling back to using the non-forge head URL verbatim (or the source URL verbatim when a tag can be extracted from its path).
Changes:
- Add a last-resort fallback in
Vulns::Scanner#build_targetto use verbatim non-forge URLs (stable/SBOM URL when a tag can be extracted from the path; otherwiseheadURL). - Add RSpec coverage for the new non-forge fallback behaviour in
#build_target.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Library/Homebrew/vulns/scanner.rb | Adds verbatim URL fallback logic when repo_url can’t normalize any candidate to a supported forge. |
| Library/Homebrew/test/vulns/scanner_spec.rb | Adds/extends specs to cover new fallback target derivation behaviour. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MikeMcQuaid
approved these changes
Jul 14, 2026
MikeMcQuaid
left a comment
Member
There was a problem hiding this comment.
Looks good, thanks! A few style nits.
33 tasks
Move the verbatim source/head URL fallback into a Scanner.target_repo_url class method so build_target's three call sites share one implementation written in the ||= style suggested in review, and add a spec for the installed-keg SBOM branch where the SBOM downloadLocation host is not a supported forge.
Compute stable_repo_url and stable_tag once at the top of build_target and reuse them in both the installed and non-installed branches, rather than repeating the same target_repo_url/tag chain twice.
p-linnane
approved these changes
Jul 14, 2026
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.
Follow-up to #23080 per @p-linnane's post-merge feedback.
repo_urlonly normalises GitHub, GitLab and Codeberg, so formulae whose stable, head and homepage URLs are all hosted elsewhere were being skipped outright. On my machine that'sbash,gmp,gnu-tar,go,make,openconnectandzsh, each of which has a non-forgehead.This restores the tap's last-resort fallback: when
repo_urlfinds no supported forge, query OSV'sGITecosystem with the source URL verbatim if its path yielded a tag, otherwise theheadURL verbatim. OSV returns nothing for these hosts today, so this is parity with the tap and future-proofing rather than a detection change.Before/after for the seven formulae above:
(all previously
SKIPPED)brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Written with Claude Code from the review feedback; I read the diff, confirmed the seven formulae now produce query targets via
brew ruby, and ranbrew lgtmlocally.