Skip to content
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: report unknowns in sbom #2998

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

kzantow
Copy link
Contributor

@kzantow kzantow commented Jun 26, 2024

This PR adds information to the file model which allows surfacing "unknowns". Previously, when scanning a source, Syft runs a number of catalogers which create packages from the files found. If an error happens, packages simply would not be created, and some logging about the error would occur. With this change, many of these errors are returned and added as context to the files output in the SBOM. Examples of "unknowns" included by this PR:

  • executable files which did not result in identified packages
  • archives which were not scanned, or did not result in packages identified
  • errors when reading information such as invalid JSON, or corrupted binary ELF data
  • ...

This PR has a set of post-cataloging steps that perform the following:

  • identify archives in the scan target which do not have packages reported, and label them as unknowns
  • remove all unknowns from files which have locations present in packages (in other words: only leave files labeled as unknowns which have no packages)

NOTE: if you would like to experiment with this, you can select the locations and unknowns from the Syft JSON like this:

go run ./cmd/syft maven:latest -o json | jq '.files.[]|select(.unknowns)|{location,unknowns}'

TODO:

  • configuration
  • assess if the unknowns in this PR are useful (e.g. python unable to parse lines in requirements.txt; and should these be retained even though packages were identified?)
  • add test coverage

Fixes: #518

Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
@github-actions github-actions bot added the json-schema Changes the json schema label Jun 26, 2024
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
json-schema Changes the json schema
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report known unknowns directly in the output SBOM
1 participant