Repository navigation
fix: store headers of SPDX YAML SBOMs in sboms_headers #2362 - #2364
Open
Jean-Regis-M wants to merge 1 commit into
Open
Jean-Regis-M wants to merge 1 commit into
Jean-Regis-M wants to merge 1 commit into
Conversation
…2362 extract_headers() only parsed .json files, so SPDX documents loaded from .yml/.yaml (supported by load_sbom since aboutcode-org#1865) never had their headers saved to project.extra_data["sboms_headers"]. Parse YAML with saneyaml, as get_spdx_document_from_file() already does, and ignore documents that are not a mapping. Signed-off-by: JEAN REGIS <190766850+Jean-Regis-M@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues
Changes
load_sbomhas accepted SPDX documents in YAML since #1865, butextract_headers()inscanpipe/pipes/resolve.pyonly parsed.jsonfiles. For a.spdx.yml/.yamlSBOM,get_manifest_headers()therefore returned{}, andget_data_from_manifests()never wrote that SBOM's entry toproject.extra_data["sboms_headers"]. The packages loaded fine, so nothing pointed to the missing headers..yml/.yamlwithsaneyaml, the same loaderget_spdx_document_from_file()uses for these files.{}when the document isn't a mapping, so a top-level list doesn't raiseAttributeErrorhere.cyclonedx_documentvariable todocument, since the function serves both SPDX and CycloneDX.test_scanpipe_resolve_get_manifest_headers_spdx_yamlusing the existingcurl-7.70.0-v2.2.spdx.ymlfixture.CycloneDX XML is still not handled by
extract_headers(). Its header fields aren't top-level keys, so I've left that out of this PR.Checklist