fix(reports): render CVSSv4 baseScore = 0.0 in JSON+XML reports#8663
Open
chadlwilson wants to merge 1 commit into
Open
fix(reports): render CVSSv4 baseScore = 0.0 in JSON+XML reports#8663chadlwilson wants to merge 1 commit into
chadlwilson wants to merge 1 commit into
Conversation
Our own code defines `baseScore` as non-null (despite being a boxed Double) and most other reports assume it is, so should be safe. The current check is problematic as Velocity treats 0 as "false" in the check, which omits 0 scores (SeverityType = NONE) which is incorrect. Seems safe and simplest to change things like this rather than contort Velocity to do a "is non-null" check. Note that there are many other places where the baseScore is taken directly within the `#if` emptiness check, so suspect this was just generated/propagated across all fields in the data naively. It's already assumed to be there in the HTML and SARIF reports, for example. Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Fixes JSON and XML reports to always include CVSS v4.0
baseScore, similar to that for CVSSv2 and CVSSv3.DependencyCheck/core/src/main/resources/templates/jsonReport.vsl
Lines 208 to 210 in 19a45fc
DependencyCheck/core/src/main/resources/templates/jsonReport.vsl
Lines 228 to 230 in 19a45fc
The model object defines
baseScoreas non-null/required (despite being a boxed Double) and most other reports assume it is, so should be safe. The DB technically allows it to be null, but many other places assume it is not.The current check is problematic as Velocity treats
0as "false" in the check, which omits 0 scores (SeverityType = NONE) which is incorrect.Seems safe and simplest to remove the check rather than contort Velocity to do an "is non-null" check. Note that there are many other places where the
baseScoreis taken directly within the#ifemptiness check, so suspect this was just generated/propagated across all fields in the data naively. It's already assumed to be there in the HTML and SARIF reports, for example.DependencyCheck/core/src/main/resources/templates/htmlReport.vsl
Line 843 in ff1a367
DependencyCheck/core/src/main/resources/templates/htmlReport.vsl
Lines 1037 to 1041 in ff1a367
Related issues
Have test cases been added to cover the new functionality?
no