|
9 | 9 | {{- range $findingTypeIndex, $findingType := $findingTypes }} |
10 | 10 | {{- $issues := getIssuesFromTestResult $result $findingType }} |
11 | 11 | {{- $issuesSize := sub (len $issues) 1 }} |
| 12 | + {{- $metadata := $result.GetMetadata }} |
12 | 13 | { |
13 | 14 | "tool": { |
14 | 15 | "driver" : { |
15 | 16 | "name" : "{{- convertTypeToDriverName (printf "%s" $findingType) }}", |
16 | 17 | "semanticVersion" : "{{- getRuntimeInfo "version" }}", |
17 | 18 | "version" : "{{- getRuntimeInfo "version" }}", |
18 | 19 | "informationUri" : "https://docs.snyk.io/", |
19 | | - "rules" : [ |
20 | | - {{- range $index, $issue := $issues }} |
21 | | - {{- $tags := buildRuleTags $issue }} |
22 | | - {{- $cvssScore := getRuleCVSSScore $issue }} |
23 | | - { |
24 | | - "id": {{ getQuotedString $issue.GetID }}, |
25 | | - "shortDescription": { |
26 | | - "text": {{ getQuotedString (buildRuleShortDescription $issue) }} |
27 | | - }, |
28 | | - "fullDescription": { |
29 | | - "text": {{ getQuotedString (buildRuleFullDescription $issue) }} |
30 | | - }, |
31 | | - "help": { |
32 | | - "text": "", |
33 | | - "markdown": {{ getQuotedString (buildRuleHelpMarkdown $issue $findingType) }} |
34 | | - }, |
35 | | - "properties": { |
36 | | - "tags": [ |
37 | | - {{- $tagsSize := sub (len $tags) 1 }} |
38 | | - {{- range $tagIndex, $tag := $tags }} |
39 | | - {{ getQuotedString (printf "%v" $tag) }}{{if lt $tagIndex $tagsSize}},{{end}} |
40 | | - {{- end }} |
41 | | - ]{{if ge $cvssScore 0.0}}, |
42 | | - "cvssv3_baseScore": {{ $cvssScore }}, |
43 | | - "security-severity": {{ getQuotedString (printf "%.1f" $cvssScore) }}{{end}} |
44 | | - } |
45 | | - }{{if lt $index $issuesSize}},{{end}} |
| 20 | + "rules" : [ |
| 21 | + {{- range $index, $issue := $issues }} |
| 22 | + {{- $tags := buildRuleTags $issue }} |
| 23 | + {{- $cvssScore := getRuleCVSSScore $issue }} |
| 24 | + { |
| 25 | + "id": {{ getQuotedString $issue.GetID }}, |
| 26 | + "shortDescription": { |
| 27 | + "text": {{ getQuotedString (buildRuleShortDescription $issue) }} |
| 28 | + }, |
| 29 | + "fullDescription": { |
| 30 | + "text": {{ getQuotedString (buildRuleFullDescription $issue) }} |
| 31 | + }, |
| 32 | + "help": { |
| 33 | + "text": "", |
| 34 | + "markdown": {{ getQuotedString (buildRuleHelpMarkdown $issue $findingType) }} |
| 35 | + }, |
| 36 | + "properties": { |
| 37 | + "tags": [ |
| 38 | + {{- $tagsSize := sub (len $tags) 1 }} |
| 39 | + {{- range $tagIndex, $tag := $tags }} |
| 40 | + {{ getQuotedString (printf "%v" $tag) }}{{if lt $tagIndex $tagsSize}},{{end}} |
| 41 | + {{- end }} |
| 42 | + ]{{if ge $cvssScore 0.0}}, |
| 43 | + "cvssv3_baseScore": {{ $cvssScore }}, |
| 44 | + "security-severity": {{ getQuotedString (printf "%.1f" $cvssScore) }}{{end}} |
| 45 | + } |
| 46 | + }{{if lt $index $issuesSize}},{{end}} |
| 47 | + {{- end }} |
| 48 | + ] |
| 49 | + {{- $dependencyCount := index $metadata "dependency-count" }} |
| 50 | + {{- if $dependencyCount }}, |
| 51 | + "properties": { |
| 52 | + "artifactsScanned": {{ $dependencyCount }} |
| 53 | + } |
46 | 54 | {{- end }} |
47 | | - ] |
48 | 55 | } |
49 | 56 | }, |
50 | 57 | "results": [ |
|
200 | 207 | }, |
201 | 208 | */ -}} |
202 | 209 | "automationDetails": { |
203 | | - {{- $projectName := index $result.GetMetadata "project-name" }} |
204 | | - "id": "{{- getAutomationDetailsId $projectName (printf "%s" $findingType) }}" |
| 210 | + {{- $projectName := index $metadata "project-name" }} |
| 211 | + "id": "{{- getAutomationDetailsId (printf "%s/%d" $projectName $resultIndex) (printf "%s" $findingType) }}" |
205 | 212 | } |
206 | 213 | }{{if or (lt $findingTypeIndex $findingTypesSize) (lt $resultIndex (sub (len $.TestResults) 1))}},{{end}}{{- end}} |
207 | 214 | {{- end}} |
|
0 commit comments