Skip to content

Commit d47f064

Browse files
authored
spdx: explain SHA1 usage (#1501)
Explain that SHA1 usage in SPDX is forced upon us from APKINDEX & git, rather than by-choice. As the checksums documented here, are those that can be externally and independently verified.
1 parent 1b66e23 commit d47f064

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/sbom/generator/spdx/spdx.go

+10
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,14 @@ func (sx *SPDX) apkPackage(opts *options.Options, pkg *apk.InstalledPackage) Pac
466466
DownloadLocation: url,
467467
Originator: fmt.Sprintf("Person: %s", pkg.Maintainer),
468468
SourceInfo: "Package info from apk database",
469+
// This is APKv2 APKINDEX SHA1 file checksum
470+
// https://wiki.alpinelinux.org/wiki/Apk_spec#Package_Checksum_Field
471+
// This is the only meaningful and signed checksum
472+
// right now. This can be upgrade to SHA256 when
473+
// switching to the v3 index format. Whilst SPDX
474+
// supports other checksums, there is currently no
475+
// other checksum that one can verify in APKINDEX or
476+
// query with apk-tools
469477
Checksums: []Checksum{
470478
{
471479
Algorithm: "SHA1",
@@ -709,6 +717,8 @@ func addSourcePackage(vcsURL string, doc *Document, parent *Package, opts *optio
709717
checksums := []Checksum{}
710718
packageName := vcsURL
711719
if url, commitHash, found := strings.Cut(vcsURL, "@"); found {
720+
// This is git commit hash, currently defined as SHA1
721+
// SHA256 is only experimental in gitlab
712722
checksums = append(checksums, Checksum{
713723
Algorithm: "SHA1",
714724
Value: commitHash,

0 commit comments

Comments
 (0)