Skip to content

fix(relationship): restore same-name guard for binary-overlap exclusion (fixes #5214) - #5227

Draft
CAOShurong wants to merge 1 commit into
anchore:mainfrom
CAOShurong:codex/5214-binary-overlap-name-match
Draft

fix(relationship): restore same-name guard for binary-overlap exclusion (fixes #5214)#5227
CAOShurong wants to merge 1 commit into
anchore:mainfrom
CAOShurong:codex/5214-binary-overlap-name-match

Conversation

@CAOShurong

Copy link
Copy Markdown
Contributor

Fixes #5214

Root cause

The ownership-overlap exclusion introduced in #1948 (fixing #931) documents four conditions for excluding a binary package when an OS/Bitnami package owns the same file - one of them being that the parent and child have identical names (so e.g. an openssl OS package may suppress a detected vendored openssl binary).

The refactors in identifyOverlappingOSRelationship / identifyOverlappingBitnamiRelationship dropped that name check: any OS or Bitnami package owning a file suppresses binary detection under it, regardless of names. That reproduces the exact symptom in #5214 - an unrelated vendor-product RPM owning a file hides the vendored OpenSSL 3.5.0 binary detection entirely.

Change

Restores a case-insensitive isSamePackageName gate in both the OS and Bitnami paths before excluding the binary candidate.

Verification (Windows, go1.26.6)

  • relationship suite all PASS including 4 new regression cases:
    • unrelated owner (vendor-product RPM) no longer excludes the binary
    • differently-named child preserved
    • case-insensitive same-name match still excluded
    • Bitnami equivalent of the above
  • red/green proven against the pre-fix behavior
  • go build ./... + go vet clean
  • failure-set diff vs clean main byte-identical across ./syft/... ./internal/... ./cmd/syft/... (pre-existing Windows env failures only; Linux CI unaffected)

Full analysis also posted on the issue thread.

…S/Bitnami packages

The ownership-overlap exclusion introduced in anchore#1948 (fix for anchore#931) was
documented as requiring the OS package and the binary detection to have
identical names, but the current implementation of
identifyOverlappingOSRelationship and
identifyOverlappingBitnamiRelationship drops the binary finding whenever
any OS package owns the file, regardless of what software the OS package
is. A vendor product RPM bundling its own copy of a library therefore
silently suppresses the binary classifier result, hiding vulnerable
vendored components from the SBOM (anchore#5214).

Restore the name-match requirement with case-insensitive comparison:
binary detections are only excluded when the owning OS or Bitnami
package has the same name, i.e. they refer to the same software.

Fixes anchore#5214

Signed-off-by: Shurong Cao <170531907+CAOShurong@users.noreply.github.com>
@spiffcs

spiffcs commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

I ran this branch on my local against 3 images just to confirm that new packages will show up:

Three images, HEAD~1 vs HEAD:

debian:12 — 88 to 89 packages, one added:
deb systemd 252.39-1~deb12u2 elf-binary-package-cataloger /usr/lib/aarch64-linux-gnu/libsystemd.so.0.35.0
Owned by debs libsystemd0/libudev1; names differ from systemd so it's no longer excluded.

ubi9/openjdk-17-runtime — 134 to 137, three added:
binary curl 7.76.1 binary-classifier-cataloger /usr/bin/curl
binary openjdk 17.0.20.1+1-LTS java-jvm-cataloger /usr/lib/jvm/java-17-openjdk-.../release
binary python 3.9.25 binary-classifier-cataloger /usr/bin/python3.9
Owning rpms present in the same SBOM: curl-minimal, java-17-openjdk-headless, python3/python3-libs.

bitnamilegacy/apache — 123 to 125:
binary httpd 2.4.64 binary-classifier-cataloger /opt/bitnami/apache/bin/httpd
deb systemd 252.38 elf-binary-package-cataloger .../libsystemd.so.0.35.0

I'm not sure I understand the fix totally yet and will take some more time tomorrow morning to read the PR and see if I can find any edge cases we're not covering. The other thing to consider is how this affects current users of syft and finding cases(if any) where the excluded package is the expected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exclude-binary-overlap-by-ownership suppresses vendored libraries owned by unrelated RPMs

2 participants