Skip to content

feat(spdx): add SHA-512 checksum support to SPDX unmarshaler#10363

Open
Mananshah237 wants to merge 1 commit intoaquasecurity:mainfrom
Mananshah237:feat/spdx-sha512-unmarshal
Open

feat(spdx): add SHA-512 checksum support to SPDX unmarshaler#10363
Mananshah237 wants to merge 1 commit intoaquasecurity:mainfrom
Mananshah237:feat/spdx-sha512-unmarshal

Conversation

@Mananshah237
Copy link
Copy Markdown

Summary

Adds SHA-512 checksum support to the SPDX unmarshaler, completing the
full round-trip support (marshal + unmarshal) for SHA-512 in SPDX.

Changes

  • Add unmarshalChecksums() to convert []spdx.Checksum to []digest.Digest
  • Update file parsing block to include checksums from spdx.Files
  • Add fallback: if no files exist but PackageChecksums is non-empty,
    store digests as a digest-only core.File entry
  • Add test data (testdata/happy/package-hashes.json) and unmarshal test case

Note

go test ./pkg/sbom/spdx/... fails with a pre-existing Go 1.26
encoding/json/jsontext build constraint issue unrelated to these changes.
go build ./pkg/sbom/spdx/... passes cleanly.

Closes #9094
Ref #9130

- Add unmarshalChecksums() to convert spdx.Checksum to digest.Digest
- Update file parsing to include checksums from spdx.Files
- Add fallback: if no files exist, store PackageChecksums as digest-only File
- Add test data and unmarshal test case for SHA-512 package checksum

Closes aquasecurity#9094
Ref aquasecurity#9130
@nikpivkin
Copy link
Copy Markdown
Contributor

Hi @Mananshah237 !

Thank you for your contribution. How does your PR differ from the one opened earlier? #9130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add SHA-512 hash support for SBOM formats (CycloneDX and SPDX)

2 participants