-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Improve support for the Component.Evidence.Identity
field in CycloneDX 1.6
#192
Comments
We also run into that issue, trivy inherits this issue :/ |
Hi everyone! I'll try to finish it today or next week. |
Created #204 |
Just my thoughts as a user of the library, regarding @DmitriyLewen's approach:
@nscuro Perhaps it could make sense to consider introducing different
One of our use cases (probably a typical one) is decoding an external JSON/XML file, which might be of any version, and use it via a specific version of the structure (which may or may not be the latest). To support this, there could be a helper function which decodes the file to the correct structure, matching the file version (e.g. extracted with Note that a similar approach has been taken for SPDX files: https://github.com/spdx/tools-golang |
I agree with your thoughts @darioandre. But this problem exists now. We have a problem - users can't scan the CycloneDX file (aquasecurity/trivy#6902 (comment)), so we want to fix this problem as soon as possible. |
see also: #207 |
It surprises me that the schema authors are able to change the type of a field from object to array when going from 1.5 to 1.6. This is the kind of breaking change I would expect going from 1.x to 2.x. Thanks to whomever is working on this. |
@esnible, Where did this happen? Could you point me to the lines in the schema? |
This sounds reasonable, however I don't currently have the bandwidth to perform such a major refactoring. If anyone would like to give this a go (pun intended!), it would be much appreciated. |
@jkowalleck I found the schema changes difficult to follow. Do these help?
@nscuro , would it be possible to change Line 626 in 464d426
RawIdentity json.RawMessage `json:"identity,omitempty" xml:"identity,omitempty"`
Identity *EvidenceIdentity `json:"-"`
Identity1_6 []EvidenceIdentity `json:"-"` ... possibly with a custom deserialize to populate Identity and Identity1_6? I am not using the Identity fields in my code but I can't deserialize some of the 1.6 SBOMs I'm seeing from cdxgen because of this. |
In CycloneDX 1.5, the
Component.Evidence.Identity
field was specified as a singleIdentity
object. In CycloneDX 1.6 this has been deprecated in favor of an array ofIdentity
objects.The specifications can be compared here:
1.5: https://cyclonedx.org/docs/1.5/json/#components_items_evidence_identity
1.6: https://cyclonedx.org/docs/1.6/json/#components_items_evidence_identity
cyclonedx-go still defines
Identity
as*EvidenceIdentity
so it fails to unmarshal SBOMs which have an array of identities in place of a single one; the error is:cannot unmarshal array into Go struct field Evidence.components.evidence.identity of type cyclonedx.EvidenceIdentity
.This currently happens with some SBOMs generated by cdxgen (https://github.com/CycloneDX/cdxgen) when using the
--spec-version 1.6
argument. This is an SBOM affected by the issue. It was generated from a skeleton Poetry project, with just pytest added, using this command:The text was updated successfully, but these errors were encountered: