Skip to content

Commit

Permalink
fix: allow cyclonedx json input with no components (#2127)
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmet Taha Özdemir <me@ahoz.de>
  • Loading branch information
ahoz authored Sep 13, 2023
1 parent c21b16d commit 5035d9c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion syft/formats/common/cyclonedxhelpers/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func GetValidator(format cyclonedx.BOMFileFormat) sbom.Validator {
}

xmlWithoutNS := format == cyclonedx.BOMFileFormatXML && !strings.Contains(bom.XMLNS, cycloneDXXmlSchema)
if (cyclonedx.BOM{} == *bom || bom.Components == nil || xmlWithoutNS) {
xmlWithoutComponents := format == cyclonedx.BOMFileFormatXML && bom.Components == nil
if (cyclonedx.BOM{} == *bom || xmlWithoutComponents || xmlWithoutNS) {
return fmt.Errorf("not a valid CycloneDX document")
}
return nil
Expand Down

0 comments on commit 5035d9c

Please sign in to comment.