-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for Bitnami cataloguer #3341
base: main
Are you sure you want to change the base?
Conversation
Bitnami images have spdx SBOMs at predictable paths, and Syft could more accurately identify the software in these images by scanning those SBOMs. Start work on this by forking the sbom-cataloger as a new bitnami-cataloger. Signed-off-by: Will Murphy <[email protected]>
Signed-off-by: Will Murphy <[email protected]>
Signed-off-by: juan131 <[email protected]>
Signed-off-by: juan131 <[email protected]>
Signed-off-by: juan131 <[email protected]>
Signed-off-by: juan131 <[email protected]>
Signed-off-by: juan131 <[email protected]>
Hi all! I just wanted to check in and see if there's anything I can do to help here. My understanding is that the current state of this PR is that @juan131 is going to implement the changes discussed in #3065 (comment). Is that everyone else's understanding? Is there anything you all need from me? Thanks! |
Yes @willmurphyscode! That's the current status Sorry for the long delay. I was on marriage leave almost all December and then Christmas came, so I've been out for a while. Let me resume the work where I left it |
Signed-off-by: juan131 <[email protected]>
Signed-off-by: juan131 <[email protected]>
Hi @juan131! I just testing this, but I'm seeing something surprising: ❯ SYFT_PACKAGE_EXCLUDE_BINARY_OVERLAP_BY_OWNERSHIP=true go run ./cmd/syft -q bitnami/postgresql:14 | rg -e NAME -e postgres
NAME VERSION TYPE
postgresql 14.15 binary
postgresql 14.15.0-9 bitnami
❯ SYFT_PACKAGE_EXCLUDE_BINARY_OVERLAP_BY_OWNERSHIP=false go run ./cmd/syft -q bitnami/postgresql:14 | rg -e NAME -e postgres
NAME VERSION TYPE
postgresql 14.15 binary
postgresql 14.15.0-9 bitnami I expected those two outputs to be different, namely that in the first output, only the bitnami postgresql package would appear. Would you mind taking a look at this? Does your understanding of what's meant to happen match mine? (Also while you're pushing changes, there are a couple conflicts with |
@willmurphyscode as I reported at #3065 (comment), the problem seems to be that binary packages doen't implement the OwnedFiles interface. |
Hi @juan131! Thanks for that comment. We've pushed a partial fix that needs some modification before it can be merged. More on that below. @wagoodman and I did some digging on this branch to understand why At https://github.com/anchore/syft/blob/main/internal/relationship/by_file_ownership.go#L87-L131, we are adding file overlap relationships in the situation where the parent (which must be a file owner) and the child (which does not need to be a file owner) if the parent owns the path that is evidence of the child. (Even non-file-owner packages have a location that Syft uses as the evidence of the package. The reason why the deduplication wasn't occurring is that on the bitnami postgres package, only On this branch, we added a commit that simply makes the packages from the Bitnami SPDX JSON own everything under, for example I'm happy to sync on this next week, since I know there's been some back and forth and we're all eager to get this in. |
@willmurphyscode thanks so much for digging on the issue and pushing the partial fix! 😊
I can see that SPDX files are also reported as files belonging to the Bitnami package. I guess, we'll have to improve the glob expression to avoid that, right? I mean, it makes little sense to consider the SPDX (e.g.
I see what you mean but, unfortunately, our SPDX files do not help on identifying what files under the directory belongs to a specific package. For instance, taking as an example the {
"SPDXID": "SPDXRef-modsecurity2",
"name": "modsecurity2",
"versionInfo": "2.9.7",
"downloadLocation": "https://github.com/SpiderLabs/ModSecurity/releases/download/v2.9.7/modsecurity-2.9.7.tar.gz",
"licenseConcluded": "Apache-2.0",
"licenseDeclared": "Apache-2.0",
"filesAnalyzed": false,
"externalRefs": [
{
"referenceCategory": "SECURITY",
"referenceType": "cpe23Type",
"referenceLocator": "cpe:2.3:*:trustwave:modsecurity:2.9.7:*:*:*:*:*:*:*"
},
{
"referenceCategory": "PACKAGE-MANAGER",
"referenceType": "purl",
"referenceLocator": "pkg:bitnami/[email protected]?arch=arm64&distro=debian-12"
}
],
"copyrightText": "NOASSERTION"
}
I don't think we have other alternatives. My concern here is: would that imply that we're unable to detect duplicates on these other secondary packages? |
It would make it so that other packages do not deduplicate. This will probably be most annoying for binaries that Syft has a binary classifier for, and for files that are scannable in their own right (e.g. JARs, binaries built by Go, binaries that have ELF metadata notes identifying the package they belong to, probably some others). I did see that some files are listed in the Bitnami SPDX. In the Postgres image we were looking at, these looked like they were JARs, for example {
"spdxElementId": "SPDXRef-pljava",
"relatedSpdxElement": "SPDXRef-Package-4afd881b870cf8ab",
"relationshipType": "CONTAINS"
},
... snip ...
{
"spdxElementId": "SPDXRef-Package-4afd881b870cf8ab",
"relatedSpdxElement": "SPDXRef-File-28d7473df5d8af04-pljava",
"relationshipType": "CONTAINS"
}, I'm not sure what the intermediate package is telling me. The PURL for the overall So the relationship seems to look like this:
It seems like maybe the best path forward is:
Does that seem like a reasonable approach @wagoodman @juan131 ? It seems like the PROs are:
|
@willmurphyscode your approach makes sense to me, I'll implement it!! By the way, do you agree on adapting the glob expression to avoid SPDX files themselves be listed as part of the "main" package?
Let me figure out why we're including that "intermediate" package you mentioned with some colleague. |
Description
This PR adds supports for a new Bitnami cataloguer so Syft is able to recognize Bitnami SBOMs and properly detect the packages available on Bitnami images.
Type of change
Checklist: