refactor(sbom): add intermediate representation for BOM (#6240)

Signed-off-by: knqyf263 <knqyf263@gmail.com>
Co-authored-by: DmitriyLewen <91113035+DmitriyLewen@users.noreply.github.com>
This commit is contained in:
Teppei Fukuda
2024-03-12 10:56:10 +04:00
committed by GitHub
parent fb8c516ded
commit 8fcef352b3
148 changed files with 4959 additions and 6190 deletions

View File

@@ -8,6 +8,7 @@ import (
"path/filepath"
"github.com/opencontainers/go-digest"
"github.com/samber/lo"
"golang.org/x/xerrors"
"github.com/aquasecurity/trivy/pkg/fanal/analyzer"
@@ -57,7 +58,7 @@ func (a Artifact) Inspect(_ context.Context) (types.ArtifactReference, error) {
blobInfo := types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
OS: bom.OS,
OS: lo.FromPtr(bom.Metadata.OS),
PackageInfos: bom.Packages,
Applications: bom.Applications,
}
@@ -87,7 +88,7 @@ func (a Artifact) Inspect(_ context.Context) (types.ArtifactReference, error) {
BlobIDs: []string{cacheKey},
// Keep an original report
CycloneDX: bom.CycloneDX,
BOM: bom.BOM,
}, nil
}