fix: don't suppress binaries owned by unrelated OS packages - #5215
Open
yzxcj797 wants to merge 1 commit into
Open
fix: don't suppress binaries owned by unrelated OS packages#5215yzxcj797 wants to merge 1 commit into
yzxcj797 wants to merge 1 commit into
Conversation
identifyOverlappingOSRelationship removed any binary package whose file overlapped an OS package's ownership, with no check that the owning package actually relates to the binary. A vendor RPM that bundles its own copy of a library (owning the binary's file but carrying none of the library's metadata) therefore suppressed the binary finding entirely, and the library's vulnerabilities went unreported — a critical CVE silently missed by grype (anchore/grype#3670). Only suppress when the owning OS package plausibly ships the binary: package names commonly embed the upstream name with prefixes and suffixes (libopenssl3, openssl-3.2.3-150700.1.1, golang-go), so an exact name match is not required, but very short binary names only match exactly to avoid suppressing on incidental substrings. The related-owner case (the original dedupe intent from anchore#931) is unchanged, as are the JVM and Bitnami overlap paths. The existing test fixtures used unrelated placeholder names, which under the new gate would (correctly) no longer be excluded, so they now use realistic related names, and new cases cover the unrelated owner and the short-name rule. Differential: on the previous code the 'unrelated OS owner does not exclude the binary' case fails — the exact suppression from the report. Full internal/relationship suite passes.
Contributor
|
Independently verified this fix against the
One thing I noticed while reading the diff: the guard only applies when |
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?
exclude-binary-overlap-by-ownership: true(the default) suppresses a binary finding when any OS package owns the file — even when the owning package is completely unrelated to the binary and carries none of its metadata. In grype this silently drops critical CVEs: a vendor RPM bundling its own OpenSSL 3.5.0 owns/opt/VendorProduct/bin/openssl, the unrelatedvendor-productRPM suppresses the binary finding, and CVE-2025-15467 goes unreported with no warning anywhere (anchore/grype#3670).Fixes the syft side of anchore/grype#3670
Why?
identifyOverlappingOSRelationshipexcluded the child binary package purely onparent.Type ∈ OS types— no relation between the names of the owning package and the detected binary was ever considered. The exclusion exists to deduplicate a binary against the distro package that legitimately ships it (#931); applied to an unrelated owner it doesn't deduplicate anything, it just hides the only package record that knew the vendored library's identity and version.How?
Gate the OS→binary exclusion on the owning package plausibly shipping the binary:
osPackageShipsBinary(pkgName, binaryName)— exact match always qualifies; otherwise the binary name (case-insensitive) must appear in the package name, which covers the common shapes (libopenssl3,openssl-3.2.3-150700.1.1,golang-go); binary names shorter than 3 characters only match exactly, so incidental substrings can't suppress anything.Testing
The existing fixtures used unrelated placeholder names (
package-aowningpackage-c), which under the gate correctly no longer exclude — they now use realistic related names (libopenssl3→openssl). New cases:unrelated OS owner does not exclude the binary(the chore(deps): bump actions/cache from 4.2.0 to 4.2.1 #3670 shape:vendor-productRPM →opensslbinary);very short binary name only matches exactly.Differential: on
mainthe unrelated-owner case fails — the binary is excluded, exactly the reported silent suppression. With this change the wholeinternal/relationshipsuite passes (go test ./internal/relationship/, full package, 1.6s).