{{/* Initialize counters */}} {{- $CountCritical := 0 }} {{- $CountHigh := 0 }} {{- $CountMedium := 0 }} {{- $CountLow := 0}} {{- $CountUnknown := 0 }} {{/* Create a list */}} {{- $FilteredMatches := list }} {{/* Loop through all vulns limit output and set count*/}} {{- range $vuln := .Matches }} {{/* Use this filter to exclude severity if needed */}} {{- if or (eq $vuln.Vulnerability.Severity "Critical") (eq $vuln.Vulnerability.Severity "High") (eq $vuln.Vulnerability.Severity "Medium") (eq $vuln.Vulnerability.Severity "Low") (eq $vuln.Vulnerability.Severity "Unknown") }} {{- $FilteredMatches = append $FilteredMatches $vuln }} {{- if eq $vuln.Vulnerability.Severity "Critical" }} {{- $CountCritical = add $CountCritical 1 }} {{- else if eq $vuln.Vulnerability.Severity "High" }} {{- $CountHigh = add $CountHigh 1 }} {{- else if eq $vuln.Vulnerability.Severity "Medium" }} {{- $CountMedium = add $CountMedium 1 }} {{- else if eq $vuln.Vulnerability.Severity "Low" }} {{- $CountLow = add $CountLow 1 }} {{- else }} {{- $CountUnknown = add $CountUnknown 1 }} {{- end }} {{- end }} {{- end }}

Container Vulnerability Report

Name: {{- if eq (.Source.Type) "image" -}} {{.Source.Target.UserInput}} {{- else if eq (.Source.Type) "directory" -}} {{.Source.Target}} {{- else if eq (.Source.Type) "file" -}} {{.Source.Target}} {{- else -}} unknown {{- end -}}

Type: {{ .Source.Type }}

Date: {{.Descriptor.Timestamp}}

Grype Logo
Critical
{{ $CountCritical }}
High
{{ $CountHigh }}
Medium
{{ $CountMedium }}
Low
{{ $CountLow }}
Unknown
{{ $CountUnknown }}
{{- range $FilteredMatches }} {{end}}
Name Version Type Vulnerability Severity Description State Fixed In
{{.Artifact.Name}} {{.Artifact.Version}} {{.Artifact.Type}} {{.Vulnerability.ID}} {{.Vulnerability.Severity}} {{html .Vulnerability.Description}} {{.Vulnerability.Fix.State}} {{- if .Vulnerability.Fix.Versions }}
    {{- range .Vulnerability.Fix.Versions }}
  • {{ . }}
  • {{- end }}
{{- else }} N/A {{- end }}