Skip to content

Commit

Permalink
fix: enforce correct type for security-severity in sarif output (#5091)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisislawatts committed Mar 5, 2024
1 parent 4f892f7 commit f0c8339
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/lib/formatters/open-source-sarif-output.ts
Expand Up @@ -88,7 +88,7 @@ ${vuln.description}`.replace(/##\s/g, '# '),
testResult.packageManager!,
],
cvssv3_baseScore: vuln.cvssScore, // AWS
'security-severity': vuln.cvssScore, // GitHub
'security-severity': String(vuln.cvssScore), // GitHub
},
};
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/formatters/sarif-output.ts
Expand Up @@ -83,7 +83,7 @@ export function getTool(testResult): sarif.Tool {
testResult.packageManager!,
],
cvssv3_baseScore: vuln.cvssScore, // AWS
'security-severity': vuln.cvssScore, // GitHub
'security-severity': String(vuln.cvssScore), // GitHub
},
};
})
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/docker/sarif-container-result.json
Expand Up @@ -31,7 +31,7 @@
"deb"
],
"cvssv3_baseScore": 6.5,
"security-severity": 6.5
"security-severity": "6.5"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/docker/sarif-with-file-container-result.json
Expand Up @@ -31,7 +31,7 @@
"deb"
],
"cvssv3_baseScore": 6.5,
"security-severity": 6.5
"security-severity": "6.5"
}
}
]
Expand Down
Expand Up @@ -51,7 +51,7 @@ describe('snyk test --sarif', () => {

expect(stdout).toContain('"artifactsScanned": 1');
expect(stdout).toContain('"cvssv3_baseScore": 5.3');
expect(stdout).toContain('"security-severity": 5.3');
expect(stdout).toContain('"security-severity": "5.3"');
expect(stdout).toContain('"fullyQualifiedName": "lodash@4.17.15"');
expect(stdout).toContain('Upgrade to lodash@4.17.17');
});
Expand Down
Expand Up @@ -79,7 +79,7 @@ Object {
"id": "SNYK-JS-AJV-584908",
"properties": Object {
"cvssv3_baseScore": 7.5,
"security-severity": 7.5,
"security-severity": "7.5",
"tags": Array [
"security",
"CWE-400",
Expand Down
Expand Up @@ -71,7 +71,7 @@ In libexpat in Expat before 2.2.7, XML input including XML names that contain a
"id": "SNYK-LINUX-EXPAT-450908",
"properties": Object {
"cvssv3_baseScore": 7.5,
"security-severity": 7.5,
"security-severity": "7.5",
"tags": Array [
"security",
"CWE-611",
Expand Down Expand Up @@ -162,7 +162,7 @@ In libexpat in Expat before 2.2.7, XML input including XML names that contain a
"id": "SNYK-LINUX-EXPAT-450908",
"properties": Object {
"cvssv3_baseScore": 7.5,
"security-severity": 7.5,
"security-severity": "7.5",
"tags": Array [
"security",
"npm",
Expand Down Expand Up @@ -252,7 +252,7 @@ In libexpat in Expat before 2.2.7, XML input including XML names that contain a
"id": "SNYK-LINUX-EXPAT-450908",
"properties": Object {
"cvssv3_baseScore": 7.5,
"security-severity": 7.5,
"security-severity": "7.5",
"tags": Array [
"security",
"CWE-611",
Expand Down

0 comments on commit f0c8339

Please sign in to comment.