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

set downloadLocation to NOASSERTION when apk.URL is unset #1372

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/sbom/generator/spdx/spdx.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ func (sx *SPDX) imagePackage(opts *options.Options) (p *Package) {

// apkPackage returns a SPDX package describing an apk
func (sx *SPDX) apkPackage(opts *options.Options, pkg *apk.InstalledPackage) Package {
url := pkg.URL
if url == "" {
url = NOASSERTION
}
return Package{
ID: stringToIdentifier(fmt.Sprintf(
"SPDXRef-Package-%s-%s", pkg.Name, pkg.Version,
Expand All @@ -459,7 +463,7 @@ func (sx *SPDX) apkPackage(opts *options.Options, pkg *apk.InstalledPackage) Pac
FilesAnalyzed: false,
LicenseConcluded: pkg.License,
Description: pkg.Description,
DownloadLocation: pkg.URL,
DownloadLocation: url,
Originator: fmt.Sprintf("Person: %s", pkg.Maintainer),
SourceInfo: "Package info from apk database",
Checksums: []Checksum{
Expand Down Expand Up @@ -562,7 +566,7 @@ type Package struct {
LicenseConcluded string `json:"licenseConcluded,omitempty"`
LicenseDeclared string `json:"licenseDeclared,omitempty"`
Description string `json:"description,omitempty"`
DownloadLocation string `json:"downloadLocation,omitempty"`
DownloadLocation string `json:"downloadLocation"`
Originator string `json:"originator,omitempty"`
Supplier string `json:"supplier,omitempty"`
SourceInfo string `json:"sourceInfo,omitempty"`
Expand Down
Loading