-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for DependencyLayerContributor and HelperLayerContributo…
…r to generate SBOMs - DependencyLayerContributor will write an SBOM with the dependency's metadata - HelperLayerContributor will write an SBOM entry with the helper's metadata - Both are written to the layer's SBOM file - The DependencyLayerContributor support adds two new metadata fields to the BuildpackDependency object: `purl` and `cpes`. - purl is a string for the package URL, based on https://github.com/package-url/purl-spec - cpes is a list of strings for multiple CPE, or Common Platform Enumeration, identifiers - the values for these two fields are loaded from dependencies entries in buildpack.toml - if not specified, they default to the Go empty values - a single artifact entry is added for each dependency - The HelpLayerContributor support generates a SBOM file with the following information. It is automatic and no additional metadata is required. - Name is `helper` - Version is the buildpack version - Licenses contains the buildpack's license - Locations contains a list of the helper names that are setup for this helper - CPEs is a list of `cpe:2.3:a:<buildpack-id>:<helper-name>:<buildpack-version:*:*:*:*:*:*:*` - PURL is `pkg:generic/<buildpack-id>@<buildpack-version>` - ID hashes for all artifacts are calculated using `github.com/mitchellh/hashstructure/v2` and are a hash of the SyftArtifact object before setting the ID. This functionality requires buildpack API 0.7, for older buildpack versions you may call these methods and they will function properly, however, the lifecycle will not persist any of the information generated. Other incidental changes in this commit: - Fixes a bug with `syft packages`. There was a typo in the command and th `-q` argument was missing. - Moves SBOM functionality from the `sherpa` package into its own package `sbom`. - Bumps to libcnb 1.25.0, which is required for the buildpack API 0.7 support. Signed-off-by: Daniel Mikusa <dmikusa@vmware.com>
- Loading branch information
Daniel Mikusa
committed
Nov 19, 2021
1 parent
6006d2f
commit 625cfd3
Showing
11 changed files
with
432 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2018-2020 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package sbom_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/sclevine/spec" | ||
"github.com/sclevine/spec/report" | ||
) | ||
|
||
func TestUnit(t *testing.T) { | ||
suite := spec.New("libpak/sbom", spec.Report(report.Terminal{})) | ||
suite("SBOM", testSBOM) | ||
suite.Run(t) | ||
} |
Oops, something went wrong.