-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(report): add CVSS vectors in sarif report #9157
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
Changes from 1 commit
30fb5fb
648c782
527433b
23918c5
761e9c0
64f62f4
19a542b
af67de4
a073a27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -118,6 +118,16 @@ func TestReportWriter_Sarif(t *testing.T) { | |
| }, | ||
| "precision": "very-high", | ||
| "security-severity": "7.5", | ||
| "cvss-vector": map[string]any{ | ||
| "nvd": map[string]any{ | ||
| "V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", | ||
| "V3Score": 9.8, | ||
| }, | ||
| "redhat": map[string]any{ | ||
| "V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", | ||
| "V3Score": 7.5, | ||
| }, | ||
| }, | ||
| }, | ||
| Help: &sarif.MultiformatMessageString{ | ||
| Text: lo.ToPtr("Vulnerability CVE-2020-0001\nSeverity: HIGH\nPackage: foo\nFixed Version: 3.4.5\nLink: [CVE-2020-0001](https://avd.aquasec.com/nvd/cve-2020-0001)\nbaz"), | ||
|
|
@@ -244,6 +254,7 @@ func TestReportWriter_Sarif(t *testing.T) { | |
| }, | ||
| "precision": "very-high", | ||
| "security-severity": "8.0", | ||
| "cvss-vector": nil, | ||
|
||
| }, | ||
| Help: &sarif.MultiformatMessageString{ | ||
| Text: lo.ToPtr("Misconfiguration KSV001\nType: Kubernetes Security Check\nSeverity: HIGH\nCheck: Image tag ':latest' used\nMessage: Message\nLink: [KSV001](https://avd.aquasec.com/appshield/ksv001)\n"), | ||
|
|
@@ -267,6 +278,7 @@ func TestReportWriter_Sarif(t *testing.T) { | |
| }, | ||
| "precision": "very-high", | ||
| "security-severity": "9.5", | ||
| "cvss-vector": nil, | ||
| }, | ||
| Help: &sarif.MultiformatMessageString{ | ||
| Text: lo.ToPtr("Misconfiguration KSV002\nType: Kubernetes Security Check\nSeverity: CRITICAL\nCheck: SYS_ADMIN capability added\nMessage: Message\nLink: [KSV002](https://avd.aquasec.com/appshield/ksv002)\n"), | ||
|
|
@@ -384,6 +396,7 @@ func TestReportWriter_Sarif(t *testing.T) { | |
| }, | ||
| "precision": "very-high", | ||
| "security-severity": "9.5", | ||
| "cvss-vector": nil, | ||
| }, | ||
| Help: &sarif.MultiformatMessageString{ | ||
| Text: lo.ToPtr("Secret AWS Secret Access Key\nSeverity: CRITICAL\nMatch: 'AWS_secret_KEY'=\"****************************************\""), | ||
|
|
@@ -477,6 +490,7 @@ func TestReportWriter_Sarif(t *testing.T) { | |
| }, | ||
| "precision": "very-high", | ||
| "security-severity": "8.0", | ||
| "cvss-vector": nil, | ||
| }, | ||
| }, | ||
| }, | ||
|
|
@@ -659,6 +673,7 @@ func TestReportWriter_Sarif(t *testing.T) { | |
| }, | ||
| "precision": "very-high", | ||
| "security-severity": "8.0", | ||
| "cvss-vector": nil, | ||
| }, | ||
| }, | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have documentation about this field or official examples?
We need to make sure we are using the correct
names/structurefor this property.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is called
cvssin json output, @axidex you can follow that naming, I guessThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed field from
cvss-vectortocvssJSON ref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is our (Trivy) field name.
But I told about
sarifschema.Does
sarifuse similar fields?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see anything like that in semgrep, codeql or any other tools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a structure for this:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to create struct for this.
cvssv2_scoreis property. (same for other fields)So should be (example):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this in the new version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I created small refactoring, can you take a look:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the refactoring! I have made changes based on your suggestions.