-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
validation of cyclonedx sboms went south since 4.11 #3759
Comments
DT versions prior to v4.11 did not validate against the CycloneDX schema at all, and that caused issues because "obvious" errors would cause the asynchronous BOM processing to fail, leaving the client that uploaded the BOM in the dark. We now validate against the schema per default, although this can be disabled in the settings as mentioned multiple times in the changelog. It is indeed possible for a BOM to be parseable, but not valid. Parsers are not good at identifying semantic issues, they may ignore unknown properties, and so on. A BOM being parseable is thus not a good indicator of whether it conforms to the specification. So I'd argue BOM validation didn't "go south", it's doing its job. The provided BOM is invalid according to the schema, so the tool that generated it needs fixing. The location of the schema you linked says a license can provide either
To my knowledge, |
afaict it tells "at least one of the id or the name is required", what comes below is optional, I don't know how this contradicts with my json. |
the validation indeed found a bug in the generation, btw, so that's nice, I don't know if that particular one is one though... |
Admittedly, the error message could be clearer, but that is sadly outside of our control since we're using a standard JSON schema validator. The JSON schema documentation itself is less vague: (The schema for |
that's not my point though, even after reading the raw schema, I still find it confusing, that required isn't only changing the behavior for requiring the field but also whether it may be included. But I guess we have to trust that the schema validation is implemented correctly? :D |
whatever, I will just remove one field, I guess it's good enough without. thank you. |
Sure, you can always challenge the implementation if you have doubts. Feel free to get the schema(s) and use whatever other validator you can find to compare results: https://github.com/CycloneDX/specification/tree/master/schema
The key here is the XOR behavior of They have an example here as well: https://json-schema.org/understanding-json-schema/reference/combining#oneOf |
yea, seeing it from a purely boolean algebra perspective, it is clear why it goes wrong, it's just weird that it does interact with "required" in the way it does, but I guess that's just the way it is |
@nscuro @MangoIV yes sbomqs currently does not validate against schema. Its something that should be added as a scoring criteria. interlynk-io/sbomqs#248 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Current Behavior
After also encountering the bug wrt the incorrect deserialization of the version field and upgrading to 4.11.1, we now have a couple more errors in an sbom that was correct before upgrading to 4.11 and is shown correct by sbomqs, there's a lot more, but I just wanted to demonstrate with one of the errors:
$.components[0].licenses: should be valid to one and only one schema, but 0 are valid
(from https://cyclonedx.org/docs/1.5/json/)
sbomqs output:
Steps to Reproduce
The sbom in question is attached
Uploading sbom.json…
Expected Behavior
The upload of the sbom continues to work
Dependency-Track Version
4.11.1
Dependency-Track Distribution
Container Image
Database Server
PostgreSQL
Database Server Version
No response
Browser
N/A
Checklist
The text was updated successfully, but these errors were encountered: