-
Notifications
You must be signed in to change notification settings - Fork 594
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
Add option to exclude packages introduced from a base layer #1809
Comments
@ericbl there are currently two different scope options: If I'm misunderstanding and you wanted to scan only the base image, you could just scan that image directly. Does this answer your question? |
that would have been my expectation too, and the output on cli looks promising but the result in the cycloneDX output do not match that. syft {my image} -o cyclonedx-json=syft-cyclone-dx_sbom_top.json syft {my image} --scope all-layers -o cyclonedx-json=syft-cyclone-dx_sbom_all.json But then, looking at both json file, they do list both all packages :( Or it is an issue with the cycloneDX output maybe? Actually, both json are listing 341 components, including all the Debian packages (~ 100 packages from debian-11-slim) |
As the name suggests, the 'squashed' option seems to list all packages visible on the top layer, but it means also packages installed on lower layers. |
So you want a diff for the top layer (or a specific layer)? The way many package managers work is they update a single database file. If you add a package, for example, the database file gets updated. This entire file is present on that layer. Without doing some sort of diff, Syft has no way of knowing which packages got added on that layer. Having said that, I think you are absolutely right that this is related to #435 and one of the solutions we have discussed could help, even if using the |
sorting the components by layer instead of just alphabetically would indeed help. |
After posting the issue here, I wrote a python script with another approach: remove any component which is found on multiple layerId, i.e. which has multiple layerId properties. Simply remove a component if layerID > 0 is found.
This is a solution to my container, and remove all debian packages from our base image. On the other hand, after discussing with colleague, working on the syft output is more than a hack than a proper solution for the related issue. Our driven 'issue' is indeed NOT related to syft or the sbom but to the tool where we export everything (sw360). So we are evaluating 'cleaner' solution. |
Related issue: #15 |
What would you like to be added:
further options on the scope flag.
Why is this needed:
First, I am not sure if I properly understood. When we speak about layer, do we speak about container layers, e.g. from docker?
If yes, I wish I could scan only the components of the 'latest' / 'top' layer of my docker images.
Indeed, in our team, I built a hierarchy of docker images, where the Dockerfile already start with
FROM {someBaseImage}
so that I share a common 'debian-base' as 'lowest' layer on all my images.
Currently, the Debian packages are duplicated in all the SBOM of all images.
I wish I could avoid this duplication.
A possible workaround is a postprocessing script filtering out components by their layerId, but it is a bit tricky to find out which layerId I want to keep!
Skipping completely the Debian registery is not a clean workaround since I might have a Debian package installed only on my 'top layer'.
Possible related issue: #435
The text was updated successfully, but these errors were encountered: