-
Notifications
You must be signed in to change notification settings - Fork 605
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
Can you control the internal format used by Syft when scanning a directory? #1938
Comments
Hi @tomasr -- Grype is always going to use the internal Syft representation. If you ingest an SBOM, this gets converted to that representation anyway. What versions of Syft and Grype are you using? |
Grype 0.78.0 |
Might help if I offer a repro. Here's an easy one:
Output here looks like this: Now first run syft to generate an SPDX SBOM of the exact same files, and scan it with grype: Output is clearly different. |
This continues being an issue in the latest release. I suspect the issue is the handling here for Windows binaries isn't just quite right? |
Hi @tomasr, sorry for the delay here. I can tell you at least a part of what's happening: when you run
However, by default
If you enable CPE matching, you will see a grype scan of the directory gives results:
When you output The GHSA-xw78-pcr6-wrg8 link you provided also may show why the github matching does not happen: it is in an unreviewed state, and there is no package information. So this entry would not be present in the Grype database. Whether Syft is generating the correct CPEs and PURLs could still be in question, this is what I see for zlib:
... so Grype would, by default, need an entry in GHSA matching the |
Thanks, @kzantow that's actually extremely useful. Didn't know about It also helped me figured out why the OpenSSL CVEs didn't get reported.... syft just generates the wrong CPEs for the libraries. |
Another note: extracting accurate information from the dotnet portable executable format is pretty challenging -- often the binaries don't contain the exact information that would match a CPE vendor or product, and the usage is inconsistent between different vendors, and even among products and/or releases over time. We're all ears for any ideas how to make the identification better across the board, if there's a way without using an external data source to look things up. (Here are some of the fields being used, if you happened to be interested in improving this) |
Another note @tomasr if you want to have fine control over what Syft is doing during a Grype run, you can do: syft -c my-syft-config.yaml | grype And grype will read the syft SBOM from stdin. There is also some work to make Grype respect Syft configs but that is in very early days. |
Thanks, agree this is a challenging item in Windows in general. I don't really have a great solution, other than probably building a list of matching regexp's or library names to known CPEs. You could also probably do it based on the reported exports for known libraries, I guess, but neither one is really a great option. @willmurphyscode Thanks for the tip. That's sort of what I am doing for now; just running syft to produce an SBOM, then manually replacing known values in it (since I know what third party stuff we have in our repo) and then feeding that into grype. Not great, but at least I can make it work. |
Hi @tomasr! I think it makes more sense to open particular issues for dotnet package cataloging or matching errors. To summarize:
I see you've already open an issue for a particular case of item 2. I think we can close this issue and track that work there. |
What would you like to be added:
This is probably a weird question, but when running
grype dir:<somedir>
, I understand grype is essentially running syft under the hood to produce the source SBOM (or similar). Can you control what format is used for this intermediate representation?Why is this needed:
My reason for asking is this: I have some dependencies in a folder.
If I run:
I get:
If I first generate an SBOM using syft in
cyclonedx-json
format, then ingest it withgrype sbom:.\sbom.json
I get the exact same result.However, if I first generate an SBOM using syft in SPDX format, then ingest it with grype I get:
So obviously the source SBOM format (or whatever the internal syft is producing over it) is somehow relevant to getting usable results?
Additional context:
The text was updated successfully, but these errors were encountered: