fix(maven): report the CVSS score that actually failed the build - #8729
Closed
Eljees wants to merge 1 commit into
Closed
fix(maven): report the CVSS score that actually failed the build#8729Eljees wants to merge 1 commit into
Eljees wants to merge 1 commit into
Conversation
checkForFailure fails the build when any of the CVSS scores of a vulnerability reaches failBuildOnCVSS, but the score it prints is the one of the newest CVSS version available. When an older version is the one that crossed the threshold, the message quotes a score below the threshold it states in the same sentence, for example vulnerabilities that have a CVSS score greater than or equal to '7.0': CVE-2021-42550(6.6) while it is the CVSSv2 score of 8.5 that failed the build. The score selection is moved into a small helper that returns the score which reached the threshold, and keeps the previous order of preference when no threshold applies. Which vulnerabilities fail the build is unchanged. relates to dependency-check#5658
Contributor
Author
|
Closing this as a duplicate of #8727, which carries the same change — the same two files and the same diff — and was opened first. Apologies for the noise; I opened this without checking that the fix was already submitted, and that's on me. Nothing is lost by closing it: #8727 has the identical patch and the same test cases. Please review there. If any wording in this description reads better than what's on #8727, say so and I'll fold it in rather than open anything further. |
Collaborator
|
Why don’t you close it yourself? you’re not in control of your bot-slop, you risk getting banned from projects for time wasting. |
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
checkForFailurefails the build when any of a vulnerability's CVSS scores reachesfailBuildOnCVSS, but the score it prints is the one from the newest CVSS version present. When an older version is what actually crossed the threshold, the message quotes a score below the threshold it states in the same sentence:There it is the CVSSv2 score of 8.5 that failed the build, not the 6.6 shown — so the message reads as a bug in the threshold rather than as a finding.
The score selection moves into a small helper that returns the score which reached the threshold, and keeps the previous order of preference (v4, then v3, then v2) for the case where no threshold applies. Which vulnerabilities fail the build is unchanged — only the number shown in the message changes.
Related issues
Have test cases been added to cover the new functionality?
Yes.
BaseDependencyCheckMojoTestgains cases for a v2-only threshold hit, a hit on a newer version, and the no-threshold path. They fail on currentmain— the assertion sees the newest-version score — and pass with the change;mvn -pl maven testgoes fromBUILD FAILUREtoTests run: 6, Failures: 0, Errors: 0.AI-assisted (LLM used for drafting); the runs above are mine.