Repository navigation
fix: compare i686 copies in installdnf, and take a Go binary's own version from its rpm in the SBOM - #204
Merged
Conversation
… pass The duplicate pass keeps one version of each package in the RPMS cache, the newer unless LOCKED_DNF names the older. It listed only x86_64 and noarch files, so an i686 package downloaded in two versions kept both, and the localinstall that follows fails on them: dnf will not install two versions of one package in one transaction. That happens once a project fetches a newer build of a multilib package the cache already holds, such as Rocky 9's openssl-libs-3.5.8-2.el9_8.i686 beside Stream's 3.5.8-1.el9.i686, which cubecos does next. An i686 copy is now compared with the other i686 copies, and x86_64 and noarch stay one set as before. The LOCKED_DNF check strips an .i686 suffix too. Verified in the jim build jail. dnf install of python3-tornado 6.5.8-1.el9 and 6.5.10-1.el9_8.1 together fails with 'cannot install both ... conflicting requests'. The patched pass, over a cache of openssl-libs 3.5.8-1.el9.i686, 3.5.8-2.el9_8.i686 and 3.5.8-2.el9_8.x86_64 and pcre2-syntax 10.40-7.el9 and 10.40-7.el9_8, removes the older i686 and the older noarch and leaves the x86_64 alone. Refs bigstack-oss/cubecos#578 Signed-off-by: Jim Lin <[email protected]> Co-authored-by: Eandalf <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
…n only guess A Go binary built from a checkout records its main module as (devel). syft then guesses a version from -X ldflags or from version-like strings in the binary, or leaves it UNKNOWN. The guess put grafana-enterprise 12.4.10 into the SBOM as github.com/grafana/grafana v3.53.2, an unrelated string in its data, so grype matched advisories for Grafana 3.x to 8.x, two of them Critical, and none for 12.4. grafana-server, grafana-cli and docker-compose were UNKNOWN and matched nothing, and docker-buildx was v0.0.2. fixgoversions.py now runs before the scan. When a binary's build info says (devel) and the rpm that ships it is the module's own package (the rpm's name carries the module's last path element), the main module takes that rpm's version from the scanned rootfs's rpm database, and its purl and CPEs follow. A binary an rpm only bundles keeps syft's version: containerd.io ships runc, which is runc 1.5.2, not 2.4.2. The SBOM that ships is the corrected one. Verified in the jim build jail on the SBOM and rootfs of CUBE_3.2.0_20261015-1249_7ae2a021. Six binaries change and nothing else: grafana, grafana-server and grafana-cli to v12.4.10, docker-buildx from v0.0.2 to v0.38.0, docker-compose to v5.6.0, and gen-manpages to v2.4.2. grype 0.119.0 on the same database then drops the 33 matches the wrong versions produced and adds none, and the corrected grafana entry set to v11.6.0 matches six advisories, so the versions are matched rather than blanked. test_fixgoversions.sh, test_projsbom.sh and test_recheckvulns.sh pass. Refs bigstack-oss/cubecos#578 Signed-off-by: Jim Lin <[email protected]> Co-authored-by: Eandalf <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
SekiXu
approved these changes
Oct 16, 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.
What type of PR is this?
/kind bug
What this PR does / why we need it
Two build fixes for cubecos's third 3.2.0 scan-review round:
9558a90.i686too.055b460(devel), so syft guesses from ldflags or from version-like strings, or leaves it UNKNOWN. grafana-enterprise 12.4.10 becamegithub.com/grafana/grafana v3.53.2(an unrelated string in its data) and was matched against advisories for Grafana 3.x–8.x, two of them Critical, and none for 12.4; grafana-server, grafana-cli and docker-compose were UNKNOWN and matched nothing.scripts/fixgoversions.pyruns before the scan. It gives such a main module its rpm's version when the binary's build info says(devel)and the rpm is the module's own package (the rpm's name carries the module's last path element), and the purl and CPEs follow. A binary an rpm only bundles keeps syft's version: containerd.io's runc stays runc 1.5.2. The SBOM that ships is the corrected one.Which issue(s) this PR fixes
Refs bigstack-oss/cubecos#578
Special notes for your reviewer
Pairs with bigstack-oss/cubecos#2116, whose hex bump points at
055b460. Both repos merge fast-forward, so the SHA stays valid.Verification:
scripts/tests/test_fixgoversions.sh(15 checks: guessed and UNKNOWN versions,/vNpaths, bundled binaries, binaries no rpm owns, a real build-info version, a non-module rpm version, a decoy magic string, an untouched rewrite),test_projsbom.sh(12) andtest_recheckvulns.sh(64), all passing.fixgoversions.pyon a real build: run in the jim build jail on the SBOM and rootfs ofCUBE_3.2.0_20261015-1249_7ae2a021. Exactly six binaries changed (grafana ×3 to v12.4.10, docker-buildx v0.0.2 → v0.38.0, docker-compose → v5.6.0, gen-manpages → v2.4.2). grype 0.119.0 on the same database dropped the 33 matches the wrong versions produced and added none. The same grafana entry set to v11.6.0 matches six advisories, so the corrected versions are matched, not blanked.python3-tornado6.5.8-1.el9 and 6.5.10-1.el9_8.1 in one install (conflicting requests). The patched pass, over Stream's and Rocky's openssl-libs i686, Rocky's x86_64 and two noarch pcre2-syntax, removes the older i686 and the older noarch and leaves the x86_64 alone.Additional documentation
🤖 Generated with Claude Code