fix(conan): add libexpat_project CPE candidates for expat packages - #5259
Open
KR-Ravindra wants to merge 1 commit into
Open
KR-Ravindra wants to merge 1 commit into
KR-Ravindra wants to merge 1 commit into
Conversation
Add libexpat_project vendor and libexpat product candidates for Conan packages named expat, so generated CPEs match the NVD entries used for libexpat vulnerabilities. Signed-off-by: KR Ravindra <42912207+KR-Ravindra@users.noreply.github.com>
Author
|
Round 1 self-review. Checked before marking ready:
Marking ready for maintainer review. |
Author
|
Self-review before marking ready. One data entry in the Conan block of |
KR-Ravindra
marked this pull request as ready for review
September 8, 2026 06:21
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.
Description
Adds curated CPE candidates for Conan
expatpackages so their CVEs (published underlibexpat_project:expat) are matched, following the existing poco/libxml2 pattern in the Conan block.Problem
Conan packages named
expat(fromconanfile.txt/conan.lock) only get name-derived CPEs such ascpe:2.3:a:expat:expat:2.5.0:*:*:*:*:*:*:*. NVD records libexpat vulnerabilities undercpe:2.3:a:libexpat_project:libexpat:...(for example CVE-2024-45492, CVE-2024-45491, CVE-2024-45490), so a scanner consuming the syft SBOM matches nothing and reports zero CVEs for a vulnerable expat version. The reporter confirmed that manually adding thelibexpat_project:libexpatCPE to the SBOM makes grype find the expected CVEs.Root cause
syft/pkg/cataloger/internal/cpegenerate/candidate_by_package_type.go:510-521(the// Conan packagesblock ofdefaultCandidateAdditions) only carries curated vendor additions forpocoandlibxml2. Conan manifests have no vendor-bearing field and the CPE dictionary does not cover the Conan ecosystem, soFromPackageAttributes(generate.go:141) falls back to the package name for both vendor and product and never produces thelibexpat_projectvendor or thelibexpatproduct.Fix
Add one entry to the Conan block, following the existing
poco -> pocoproject/libxml2 -> xmlsoftpattern:{ pkg.ConanPkg, candidateKey{PkgName: "expat"}, candidateAddition{AdditionalVendors: []string{"libexpat_project"}, AdditionalProducts: []string{"libexpat"}}, },These are additions only; the name-derived candidates are kept, so no existing match is removed. Because
candidateVendorsalso considers every product candidate as a vendor (generate.go:204), the generated set forexpat/2.5.0becomes:How tested
Two unit tests were added first and run against
mainto reproduce the gap:Test_defaultCandidateAdditions_conan_expatincandidate_by_package_type_test.go(mirrorsTest_defaultCandidateAdditions_conan_libxml2, also checks the product addition)conan expatcase inTestGeneratePackageCPEs(generate_test.go) asserting the full generated CPE setBefore the fix:
After the fix:
go test ./syft/pkg/cataloger/internal/cpegenerate/...passes,gofmt -lis clean,go vetpasses,go build ./syft/... ./cmd/...succeeds, andgolangci-lint runon the package reports the same pre-existing findings asmainwith nothing new.Type of change
Checklist
Issue references
Fixes #4771
Links
This change was prepared with an AI agent operated by KR-Ravindra, who reviewed and tested it.