-
Notifications
You must be signed in to change notification settings - Fork 505
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
Fixes to SBOM libraries #2096
Fixes to SBOM libraries #2096
Conversation
This commit adds support to define the main license of the document, its name, creator data in the options. These fields can be set from the YAML configuration file.
This is the forst commit of the unit test file for the spdx doc builder. There is =nly one test for now: TestYAMLParse which check the yaml configuration file.
This commit adds a mutex to the spdx package and parallelizes the read operations that scan the filsystem when processing a directory. The improvement generating the kubernetes SBOM: real 2m36.691s user 12m24.276s sys 0m13.644s real 4m51.323s user 12m30.231s sys 0m13.937s Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
When generating a package from a directory, we now relativize all file paths to the initial directory. Previously, all paths would reflect the command invoked. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
When checking dependencies, use the local cached replacements of packages if they are available. This will avoid downloading all of the kubernetes packages when generating the k8s SBOM. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
When cleaning up Go modules, we now only erased temporary directories created by our run to avoid deleting files from the local GOPATH. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
There was a bug in the license catalog logic where license data was written incorrectly in the downloads cache. This commit fixes it so that license data is now stored separate of the downloads directory. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
To satisfy cncf requirements, we now return the full text of scanned licenses to include them in the SBOM. As we are now handling more data, the datastructure of the license list is now a slice of pointers. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
This commit adds a new function to the license package: ReadTopLicense() This function tries to determine the most significant license file in a directory by first trying some common names at the top of the tree and then working its way down looking for the topmost one. The use of this function saves thousands of license scans and reduces memory footprint when genearting the kubernetes sbom. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Since this PR was on hold, I've pushed the next set of the SBOM fixes and features that surfaced after I have tested these changes in a stage run here: |
/hold cancel |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: puerco, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
/kind design
/kind bug
What this PR does / why we need it:
This PR compiles several fixes and features that need to be addressed to the sbom libraries after the first SBOM test after alpha.3. Namely, this PR has the following changes:
bom
the capability to configure the sbom components from a YAML file *more below)license.ReadTopLicense()
will scan and return only the most significant license in a directory, potentially avoiding thousands of operations in the classifier code.SBOM artifacts YAML definition file
Defining a bill of materials that has multiple packages, from different sources (files, images, directories, etc), can be cumbersome to do from the command line. This PR adds initial support to define a BOM in a declarative way from a yaml file. In this iteration,
bom
has a new flag-c --config
which points to the yaml file. In future versions and use cases (for example when run from CI or GitHub actions), we could defaultbom
to look for a.sbom.yaml
file in a repository.A sample of a yaml file looks like this:
To run bom with that file:
This configuration would render a SBOM with one loose file (SECURITY.md) and three packages: a directory, an image and a docker archive tarball.
Which issue(s) this PR fixes:
Part of #2085
Part of #1837
Special notes for your reviewer:
The format of the config file will be evolving as we start using it and finding new needs
Requires #2085 to merge and a rebase (only the last three commits are relevant)Does this PR introduce a user-facing change?
/milestone v1.22