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

spdx: explain SHA1 usage #1501

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions pkg/sbom/generator/spdx/spdx.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,14 @@ func (sx *SPDX) apkPackage(opts *options.Options, pkg *apk.InstalledPackage) Pac
DownloadLocation: url,
Originator: fmt.Sprintf("Person: %s", pkg.Maintainer),
SourceInfo: "Package info from apk database",
// This is APKv2 APKINDEX SHA1 file checksum
// https://wiki.alpinelinux.org/wiki/Apk_spec#Package_Checksum_Field
// This is the only meaningful and signed checksum
// right now. This can be upgrade to SHA256 when
// switching to the v3 index format. Whilst SPDX
// supports other checksums, there is currently no
// other checksum that one can verify in APKINDEX or
// query with apk-tools
Checksums: []Checksum{
{
Algorithm: "SHA1",
Expand Down Expand Up @@ -709,6 +717,8 @@ func addSourcePackage(vcsURL string, doc *Document, parent *Package, opts *optio
checksums := []Checksum{}
packageName := vcsURL
if url, commitHash, found := strings.Cut(vcsURL, "@"); found {
// This is git commit hash, currently defined as SHA1
// SHA256 is only experimental in gitlab
checksums = append(checksums, Checksum{
Algorithm: "SHA1",
Value: commitHash,
Expand Down
Loading