Repository navigation
Conversation
The Jackson store does not keep the document's SPDXID when it reads a JSON, YAML or XML file and always creates the document as SPDXRef-DOCUMENT, so the model's verify never sees the original value and a document with any other ID was reported as valid. The spec requires the document SPDXID to be SPDXRef-DOCUMENT [1]. Read the SPDXID from the file in Verify and report it with the same message the tag-value parser already uses. Part of Issue 316. [1] https://spdx.github.io/spdx-spec/v2.3/document-creation-information/#63-spdx-identifier-field Signed-off-by: Tommy Quak <tommy@u.nus.edu>
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.
Part of #316.
When a JSON, YAML or XML file is read, the Jackson store skips the document's
SPDXIDand always creates the document asSPDXRef-DOCUMENT, soSpdxDocument.verify()never sees the original value. A document with any other ID is reported as valid, although the spec requiresSPDXRef-DOCUMENT[1]. Tag-value files already fail with "SPDX Document SPDXRef-NOTDOC is invalid. Document IDs must be SPDXRef-DOCUMENT".As discussed in #316, this checks the ID in
Verifyitself: it reads theSPDXIDfrom the file and reports the same message as tag-value. I added a test with a JSON, YAML and XML file whose document ID isSPDXRef-NOTDOC.Tested with
mvn verify,checkstyle:checkandspotbugs:checkon Java 17, and by running the built jar on the files from the issue: the document whose IDSPDXRef-ais also a package ID is now reported as invalid, and the example files are still valid.Not covered here:
Verifygets to this check, so that error is unchanged.[1] https://spdx.github.io/spdx-spec/v2.3/document-creation-information/#63-spdx-identifier-field