-
Notifications
You must be signed in to change notification settings - Fork 75
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 fails because of rounding in anyOf/baseScore/baseSeverity #1204
Comments
Hi, as it seems to be an issue related to ajv-validator/ajv#652 I don't think it is the FIRST responsibility to come up with a variant of the current JSON schema to avoid a bug in another spec (JSON Schema) implementation. As with this we end up in a dead end, I see two options: the CVEProject overloads the FIRST Schema to fit its own implementation details (might not be a good idea for many reasons), or overload the |
The rationale for asking FIRST to change their schema is that use of multipleOf with floating point is a known interoperability problem with JSON schema that has affected multiple validator implementations over about the past ten years, and a change could benefit their wider community, e.g., https://swagger.io/docs/specification/data-models/data-types/ (recommendation from the Swagger project: "multipleOf may be used with floating-point numbers, but in practice this can be unreliable due to the limited precision or floating point math.") https://news.ycombinator.com/item?id=34588911 (2023) |
Fix for validation rounding issue in CVSS v4 baseSeverity. Replaced mulipleOf with enum lists of the correct score values. See CVEProject/cve-services#1204 for more details. This matches the schema used by CVE Services as of April 2024.
A large fraction of valid CNA containers with CVSS scores get
when submitting to CVE Services 2.3.0. For example, although the CVSS "LOW" range is 0.1 through 3.9, "LOW" works with a 2.2 CVSS score but does not work with a 2.3 CVSS score. This occurs because schema validation uses ajv without a mitigation for IEEE 754 rounding rules. The CVE Records (regardless of 2.2 versus 2.3) do validate with some other JSON validators such as jsonschemavalidator.net (when using exactly the same schema) but it will probably be necessary to continue using ajv to avoid large software integration costs and to maintain the user experience for error messages.
Solutions might include:
multipleOf
and simply accept the risk that a provider may enter more than one decimal digit such as an anomalous CVSS score of 2.25(options 3 and 4 mean that CVE Services would be less strict than the schema advocated by the QWG)
We could instead ask FIRST to change their CVSS schema to use approaches like:
which may make it interoperable with both ajv and a number of other schema validators.
This affects, for example, both CVSS 3.1 and CVSS 4.0 because CVE Services is implementing baseScore/baseSeverity checks for both in essentially the same way. The baseScore/baseSeverity checks for CVSS 4.0 in CVE Services are inherently part of https://www.first.org/cvss/cvss-v4.0.json and thus it's not possible to use ajv as-is and still comply with the FIRST specification.
Note that the problem is not limited to CNAs who intentionally choose strange CVSS scores. A CNA who simply goes to Vulnogram, and clicks on the buttons under Metrics in a completely normal way, will often end up with a CNA container that cannot successfully be submitted to CVE Services, even though it's in exactly the correct format according to the schema. In other words, addressing this GitHub issue is almost certainly a blocker for the production release.
It is also easy to reproduce the issue from a command line. For example, this CNA container can be submitted:
but this one cannot (it gets the INVALID_JSON_SCHEMA error) even though the only difference is increasing 2.2 to 2.3:
The text was updated successfully, but these errors were encountered: