-
Notifications
You must be signed in to change notification settings - Fork 555
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
CycloneDX output metadata.properties
set to null
instead of empty array or omitted.
#1759
Comments
metadata.properties
set to null
instead of empty array.metadata.properties
set to null
instead of empty array or omitted.
Hi @Cerebus, thank you for the report! We'll get this taken care of as soon as we can. |
this is in the category of ensuring that all collections like this are allocated (currently this is |
Hi @tgerla @wagoodman, I am interested in working on this. It appears that the It happens when I have two potential solutions that I'd appreciate your feedback on before submitting a PR:
cyclonedxBOM.Metadata.Properties = &[]cyclonedx.Property{} // populates the properties field as an empty array []
cyclonedxBOM.Metadata.Properties = nil // properties field does not get encoded
func toBomProperties(srcMetadata source.Description) *[]cyclonedx.Property {
metadata, ok := srcMetadata.Metadata.(source.ImageMetadata)
if ok {
props := helpers.EncodeProperties(metadata.Labels, "syft:image:labels")
if props == nil {
return nil
}
return &props
}
return nil
} I’m happy to implement either solution. Thanks! |
It's also worth noting that the |
@lucasrod16 it looks like the properties are optional, I'd opt for option 2, returning an accurate |
@kzantow I have opened a PR to syft to return a |
What happened:
What you expected to happen:
It should validate. E.g., after replacing
metadata.properties: null
with[]
:How to reproduce it (as minimally and precisely as possible):
See above.
Anything else we need to know?:
Environment:
Application: grype
Version: 0.74.7
BuildDate: 2024-02-26T17:30:31Z
GitCommit: brew
GitDescription: [not provided]
Platform: darwin/amd64
GoVersion: go1.22.0
Compiler: gc
Syft Version: v0.105.1
Supported DB Schema: 5
The text was updated successfully, but these errors were encountered: