You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validating a duplicate component (one instance in the metadata and one in the components section) in the json SBOM does not create a validation error. The same duplicate does create a validation error in the xml SBOM.
Used version: 0.27.2
The big question
Is the xml behaviour correct, or the json behaviour? This also creates a problem with #326 (comment), as the metadata component is duplicated, reproducing this exact issue in xml, while not creating a problem in json.
Repro
When an sbom is in xml and has a duplicate component (sambo) between the metadata component and a normal one, the validation fails:
.\cyclonedx-cli.exe validate --input-file test.xml --input-version v1_6
Validating XML BOM...
Validation failed at line number 82 and position 7: There is a duplicate key sequence '@sambo@4.4.4' for the 'http://cyclonedx.org/schema/bom/1.6:bom-ref' key or unique identity constraint.
BOM is not valid.
The workaround of adding an extra name and version as a metadata component does not really work. This is because when later merging the sbom in a downstream project, the merge adds those metadata components which do not represent parts of the application.
The xml schema allows to enforce this directly in the schema, json schema doesn't have an equivalent concept. At the moment, all the validation does is to check against the schema. There is a PR to detect duplicated bom-refs, but it hasn't yet made it into a release: CycloneDX/cyclonedx-dotnet-library#240
In addition, the fact that flat merges can cause issues with duplicated bom-refs is known (there are several open issues). The behavior has been partially improved, but there isn't a complete agreement on how to approach it (and there are several open PRs that try to improve it).
Intro
Validating a duplicate component (one instance in the metadata and one in the components section) in the json SBOM does not create a validation error. The same duplicate does create a validation error in the xml SBOM.
Used version: 0.27.2
The big question
Is the xml behaviour correct, or the json behaviour? This also creates a problem with #326 (comment), as the metadata component is duplicated, reproducing this exact issue in xml, while not creating a problem in json.
Repro
When an sbom is in xml and has a duplicate component (
sambo
) between the metadata component and a normal one, the validation fails:When I convert that sbom to a json one:
and validate that, the bom validates successfully, even though the
sambo
component exists in the metadata and thecomponents
list:The text was updated successfully, but these errors were encountered: