Skip to content
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

fix: sort descending by CVSS scores first #27

Merged
merged 9 commits into from
Dec 1, 2023
Merged

Conversation

jamestelfer
Copy link
Member

@jamestelfer jamestelfer commented Nov 26, 2023

Tip

This PR reads commit-by-commit

Based on CVSS3 support added in #26.

Leads to more readily understandable annotations as the most critical are rendered higher.

CVSS3 and CVSS2 schemes are sorted separately because their scoring outcomes are not comparable. This means that in longer lists, CVSS2 results are pushed down the page, however considering that AWS is moving away from CVSS2 and few images have such a massive pile of issues it's probably the right trade-off.

Sort is by:

  • severity rank, then
  • CVSS3 score desc
  • CVSS2 score desc
  • CVE name desc

Example:
image

@jamestelfer jamestelfer changed the base branch from main to support-cvss3 November 26, 2023 12:24
Base automatically changed from support-cvss3 to main November 30, 2023 00:42
It requires the use of another tool, and is more opinionated than
worthwhile.
Applies feedback on the CVSS2 version to this one.
The inline expectations are getting large, and the upcoming change
includes a structure with private internals.

Ignore *findingconfig.Ignore
}

type CVSSScore struct {
Score *decimal.Decimal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Why use a pointer to a Decimal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because html/template understands nil more easily than Decimal{} making the rendering logic easier. Also it helps make it clear when the score is not supplied versus valued. I originally wrote this without the pointer, switching only when it came to rendering.

src/finding/summary.go Outdated Show resolved Hide resolved
src/finding/summary.go Outdated Show resolved Hide resolved
src/finding/summary.go Outdated Show resolved Hide resolved
src/report/annotation.go Outdated Show resolved Hide resolved
jamestelfer and others added 3 commits November 30, 2023 12:53
Co-authored-by: Callum Gardner <callum.gardner@cultureamp.com>
Co-authored-by: Callum Gardner <callum.gardner@cultureamp.com>
Co-authored-by: Callum Gardner <callum.gardner@cultureamp.com>
Copy link
Member Author

@jamestelfer jamestelfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Responses

@jamestelfer
Copy link
Member Author

For some reason my comments via vscode were added to a review rather than just answering the thread. TIL

@ctgardner
Copy link
Contributor

For some reason my comments via vscode were added to a review rather than just answering the thread. TIL

Yep, it's a limitation of the VS Code extension. It's still my preferred method of reviewing PRs though, including this one. 😉

@jamestelfer jamestelfer merged commit 80c73bf into main Dec 1, 2023
10 checks passed
@jamestelfer jamestelfer deleted the sort-by-score branch December 1, 2023 01:10
@jamestelfer jamestelfer mentioned this pull request Mar 15, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants