Expose formula patches in the JSON API (and optionally annotate them with CVEs) #6869
Replies: 6 comments 1 reply
-
|
Yeh, these both make sense to me! PRs welcome. |
Beta Was this translation helpful? Give feedback.
-
|
PR for part one: Homebrew/brew#22459 |
Beta Was this translation helpful? Give feedback.
-
|
22459 merged, patch data now in the api:
Example from llvm: next up, part 2 |
Beta Was this translation helpful? Give feedback.
-
|
Part 2 patch to add |
Beta Was this translation helpful? Give feedback.
-
|
PR for part two: Homebrew/brew#22466 Ended up going with patch do
url "https://deb.debian.org/.../libquicktime_1.2.4-12.debian.tar.xz"
sha256 "..."
type :backport
resolves "CVE-2016-2399", "CVE-2017-9122"
apply "patches/CVE-2016-2399.patch", "patches/CVE-2017-9122_et_al.patch"
end
"type": "backport",
"resolves": [
{"type": "security", "id": "CVE-2016-2399"},
{"type": "security", "id": "CVE-2017-9122"}
]The inference Mike suggested is in there too: CVE ids found in the patch |
Beta Was this translation helpful? Give feedback.
-
|
For backfilling the existing 1,191 patches across 809 formulae, here's where the data sits today and where By patch kind
External patches by source (n=972)
Already inferable with no formula changes (once #22466 lands): 25 unique CVEs across The 497 GitHub commit patches are the big prize for automation since OSV indexes fix-commits → CVEs directly. The 272 Homebrew-hosted raw patches are almost entirely macOS/compiler build fixes and will mostly end up with no |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
While working on
brew-vulnsI wanted to find every formula in homebrew-core that ships with a patch applied. There's currently no way to get this frombrew info --jsonor formulae.brew.sh;Formula#to_hashdoesn't serialisepatchlist, and formulae loaded from the API have an emptypatchlist. The only options today are grepping a homebrew-core checkout forpatch do/patch :DATA, or runningbrew rubywithHOMEBREW_NO_INSTALL_FROM_API=1and walkingFormula.all. Roughly 860 of the ~8400 core formulae currently carry at least one patch.1. Add a
patcheskey toFormula#to_hash. Something like:This would let
brew-vulnsand other downstream tooling (SBOM generators, OSV importers, distro-comparison tools) see which packages Homebrew has modified relative to the upstream tarball, without needing a full core checkout.2. Allow patches to declare which CVEs they address. Right now this lives in comments:
glibcapplies a Debian patch tarball withapply "patches/any/CVE-2024-2961.patch",libquicktimehas# Fix CVE-2016-2399above itspatch doblock. Only about eight formulae mention a CVE at all, and where the data exists it can't be read programmatically. A small DSL addition would cover it:which would surface in the JSON as
"fixes": ["CVE-2016-2399", "CVE-2017-9122"]on each patch entry. This is the same shape Fedora uses in spec changelogs and Alpine uses insecfixes:blocks, and it would let vulnerability scanners report "yes this version is affected upstream, but Homebrew's bottle is patched" instead of raising a false positive. Related: in #6826 @SMillerDev suggested handling CVEs at the audit layer; structured patch data would give that audit something to read.I'm happy to put together the PR for part 1 if there's appetite; part 2 is more of a policy question about whether maintainers want to track that data in formulae at all.
Beta Was this translation helpful? Give feedback.
All reactions