Skip to content

Commit

Permalink
fix: SARIF: artifactChanges property cannot be empty (#5010)
Browse files Browse the repository at this point in the history
  • Loading branch information
schottsfired authored Jan 19, 2024
1 parent b6f5c98 commit 2dd4f9e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
21 changes: 20 additions & 1 deletion src/lib/formatters/get-sarif-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,26 @@ export function getResults(testResult: TestResult): sarif.Result[] {
description: {
text: `Upgrade to ${vuln.upgradePath[1]}`,
},
artifactChanges: [],
artifactChanges: [
{
artifactLocation: {
uri: getArtifactLocationUri(
testResult.displayTargetFile,
testResult.path,
),
},
replacements: [
{
deletedRegion: {
startLine: vuln.lineNumber || 1,
},
insertedContent: {
text: vuln.upgradePath[1] as string,
},
},
],
},
],
},
]
: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,23 @@ Object {
Object {
"fixes": Array [
Object {
"artifactChanges": Array [],
"artifactChanges": Array [
Object {
"artifactLocation": Object {
"uri": "package.json",
},
"replacements": Array [
Object {
"deletedRegion": Object {
"startLine": 1,
},
"insertedContent": Object {
"text": "jimp@0.2.28",
},
},
],
},
],
"description": Object {
"text": "Upgrade to jimp@0.2.28",
},
Expand Down

0 comments on commit 2dd4f9e

Please sign in to comment.