github.com/seilagamo/poc-lava-release@v0.3.3-rc3/internal/report/templates/human.tmpl (about) 1 {{- /* report is the template used to render the full scan report. */ -}} 2 {{- define "report" -}} 3 {{"SUMMARY" | bold | underline}} 4 {{if .Total}} 5 {{template "summary" .}} 6 {{else}} 7 No vulnerabilities found during the scan. 8 {{end}} 9 {{- if .Vulns}} 10 {{template "vulns" . -}} 11 {{end -}} 12 {{- end -}} 13 14 15 {{- /* summary is the template used to render the scan summary. */ -}} 16 {{- define "summary" -}} 17 {{"CRITICAL" | bold | magenta}}: {{index .Stats "critical"}} 18 {{"HIGH" | bold | red}}: {{index .Stats "high"}} 19 {{"MEDIUM" | bold | yellow}}: {{index .Stats "medium"}} 20 {{"LOW" | bold | cyan}}: {{index .Stats "low"}} 21 {{"INFO" | bold}}: {{index .Stats "info"}} 22 23 Number of excluded vulnerabilities not included in the summary table: {{.Excluded}} 24 {{- end -}} 25 26 27 {{- /* vulns is the template used to render all the vulnerability reports. */ -}} 28 {{- define "vulns" -}} 29 {{"VULNERABILITIES" | bold | underline}} 30 {{range .Vulns}} 31 {{template "vuln" . -}} 32 {{end}} 33 {{- end -}} 34 35 36 {{- /* vuln is the template used to render one vulnerability report */ -}} 37 {{- define "vuln" -}} 38 {{template "vulnTitle" .}} 39 40 {{"TARGET" | bold}} 41 {{.CheckData.Target | trim}} 42 {{""}} 43 44 {{- $affectedResource:= .AffectedResourceString -}} 45 {{- if not $affectedResource -}} 46 {{- $affectedResource = .AffectedResource -}} 47 {{- end -}} 48 {{- if $affectedResource}} 49 {{"AFFECTED RESOURCE" | bold}} 50 {{$affectedResource | trim}} 51 {{end -}} 52 53 {{- if .Description}} 54 {{"DESCRIPTION" | bold}} 55 {{.Description | trim}} 56 {{end -}} 57 58 {{- if .Details}} 59 {{"DETAILS" | bold}} 60 {{.Details | trim}} 61 {{end -}} 62 63 {{- if .ImpactDetails}} 64 {{"IMPACT" | bold}} 65 {{.ImpactDetails | trim}} 66 {{end -}} 67 68 {{- if .Recommendations}} 69 {{template "vulnRecoms" .}} 70 {{end -}} 71 72 {{- if .References}} 73 {{template "vulnRefs" .}} 74 {{end -}} 75 76 {{- if .Resources}} 77 {{template "vulnRscs" .}} 78 {{end -}} 79 {{- end -}} 80 81 82 {{- /* vulnTitle is the template used to render the title of a vulnerability. */ -}} 83 {{- define "vulnTitle" -}} 84 {{- if eq .Severity.String "critical" -}} 85 {{printf "=== %v (%v) ===" (trim .Summary) (upper .Severity.String) | bold | magenta}} 86 {{- else if eq .Severity.String "high" -}} 87 {{printf "=== %v (%v) ===" (trim .Summary) (upper .Severity.String) | bold | red}} 88 {{- else if eq .Severity.String "medium" -}} 89 {{printf "=== %v (%v) ===" (trim .Summary) (upper .Severity.String) | bold | yellow}} 90 {{- else if eq .Severity.String "low" -}} 91 {{printf "=== %v (%v) ===" (trim .Summary) (upper .Severity.String) | bold | cyan}} 92 {{- else -}} 93 {{printf "=== %v (%v) ===" (trim .Summary) (upper .Severity.String) | bold}} 94 {{- end -}} 95 {{- end -}} 96 97 98 {{- /* vulnRecoms is the template used to render the recommendations to fix a vulnerability. */ -}} 99 {{- define "vulnRecoms" -}} 100 {{"RECOMMENDATIONS" | bold}} 101 {{- range .Recommendations}} 102 - {{. | trim -}} 103 {{end}} 104 {{- end -}} 105 106 107 {{- /* vulnRefs is the template used to render a list of references with more details about the vulnerability. */ -}} 108 {{- define "vulnRefs" -}} 109 {{"REFERENCES" | bold}} 110 {{- range .References}} 111 - {{. | trim -}} 112 {{end}} 113 {{- end -}} 114 115 116 {{- /* vulnRscs is the template used to render the list of affected resources. */ -}} 117 {{- define "vulnRscs" -}} 118 {{"RESOURCES" | bold}} 119 {{- range $resource := .Resources}} 120 {{template "vulnRsc" . -}} 121 {{end}} 122 {{- end -}} 123 124 125 {{- /* vulnRsc is the template used to render the details of a single resource. */ -}} 126 {{- define "vulnRsc" -}} 127 {{- $rsc := . -}} 128 - {{$rsc.Name | bold}}: 129 {{- range $row := $rsc.Rows}}{{range $header := $rsc.Header}} 130 {{$header | trim | bold}}: {{index $row $header | trim -}} 131 {{end}}{{end}} 132 {{- end -}} 133 134 135 {{- template "report" . -}}