Skip to content

fix: compare i686 copies in installdnf, and take a Go binary's own version from its rpm in the SBOM - #204

Merged
github-actions[bot] merged 2 commits into
developfrom
jim.lin/fix/vuln-handling-1
Oct 16, 2026
Merged

github-actions[bot] merged 2 commits into
developfrom
jim.lin/fix/vuln-handling-1

Conversation

@Eandalf-Bigstack

@Eandalf-Bigstack Eandalf-Bigstack commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

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:

commit change
9558a90 installdnf: i686 copies are compared with each other in the duplicate pass. The pass kept one version of each package in the RPMS cache, but it listed only x86_64 and noarch files, so an i686 package fetched in two versions kept both, and the localinstall that follows fails: dnf will not install two versions of one package in one transaction. cubecos needs this to take Rocky's openssl-libs/openssl-devel 3.5.8-2.el9_8.i686 beside Stream's 3.5.8-1.el9.i686. The LOCKED_DNF check strips .i686 too.
055b460 SBOM: a Go binary's own version comes from its rpm where syft can only guess. A binary built from a checkout says (devel), so syft guesses from ldflags or from version-like strings, or leaves it UNKNOWN. grafana-enterprise 12.4.10 became github.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.py runs 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

Note

Pairs with bigstack-oss/cubecos#2116, whose hex bump points at 055b460. Both repos merge fast-forward, so the SHA stays valid.

Verification:

  • Unit tests: scripts/tests/test_fixgoversions.sh (15 checks: guessed and UNKNOWN versions, /vN paths, 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) and test_recheckvulns.sh (64), all passing.
  • fixgoversions.py on a real build: run in the jim build jail on the SBOM and rootfs of CUBE_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.
  • installdnf: dnf refuses python3-tornado 6.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

NONE

🤖 Generated with Claude Code

Eandalf-Bigstack and others added 2 commits October 16, 2026 12:58
… 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 SekiXu added the done Merge the pull request label Oct 16, 2026
@github-actions
github-actions Bot merged commit 055b460 into develop Oct 16, 2026
7 checks passed
@github-actions
github-actions Bot deleted the jim.lin/fix/vuln-handling-1 branch October 16, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

done Merge the pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants