-
Notifications
You must be signed in to change notification settings - Fork 8
/
sonarqube.tpl
39 lines (38 loc) · 1.11 KB
/
sonarqube.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{{- /* Template based on https://docs.sonarqube.org/latest/analysis/generic-issue/ */ -}}
{
"issues": [
{{- $t_first := true }}
{{- range $result := . }}
{{- $vulnerabilityType := .Type }}
{{- range .Vulnerabilities -}}
{{- if $t_first -}}
{{- $t_first = false -}}
{{ else -}}
,
{{- end }}
{
"engineId": "TRIVY",
"ruleId": "{{$vulnerabilityType}}",
"severity": {{ if eq .Severity "UNKNOWN" -}}
"INFO"
{{- else if eq .Severity "LOW" -}}
"INFO"
{{- else if eq .Severity "MEDIUM" -}}
"MINOR"
{{- else if eq .Severity "HIGH" -}}
"MAJOR"
{{- else if eq .Severity "CRITICAL" -}}
"CRITICAL"
{{- else -}}
"INFO"
{{- end }},
"type": "VULNERABILITY",
"primaryLocation": {
"message": "{{ .PkgName }} - {{ .VulnerabilityID }} - {{ .Title }}",
"filePath": "{{ $result.Target }}"
}
}
{{- end -}}
{{- end }}
]
}